Skip to content

Instantly share code, notes, and snippets.

View kazeburo's full-sized avatar

Masahiro Nagano kazeburo

View GitHub Profile
diff --git a/XS.xs b/XS.xs
index 4bf4c2a..cbe32bd 100644
--- a/XS.xs
+++ b/XS.xs
@@ -121,13 +121,14 @@ struct _ust {
static void
url_params_each(pTHX_ const char *s, const STRLEN len, const ust_t *u) {
+ static const char sep[] = "&;";
const char *send = s + len;
*** glibc detected *** /usr/sbin/mysqld: double free or corruption (!prev): 0x00007fc7780a5a60 ***
*** glibc detected *** /usr/sbin/mysqld: corrupted double-linked list: 0x00007fc66807def0 ***
======= Backtrace: =========
/lib64/libc.so.6[0x376b476166]
/lib64/libc.so.6[0x376b478f81]
======= Backtrace: =========
/usr/lib64/libgroonga.so.0(grn_free_default+0x31)[0x7fcc686dbfe1]
/lib64/libc.so.6[0x376b476166]
/usr/lib64/libgroonga.so.0(grn_obj_close+0x34b)[0x7fcc686eca6b]
/lib64/libc.so.6[0x376b478c93]
our %EncodeMap;
for my $num ( 0 .. 255 ) {
my $chr = chr $num;
my $h = sprintf "%02X", $num;
$EncodeMap{$chr} = '%'. uc $h;
}
$EncodeMap{" "} = '+';
sub url_escape {
return '' unless defined $_[0];

mroongaでクエリを投げる並列数をあげていくと、レスポンスが悪化する件

使用しているデータは http://blog.livedoor.jp/staff/ の記事データです。1500件ほどあります

環境は EC2 cc2.8xlarge 8コア 32コア

MySQL 5.6.15。オラクル公式MySQL rpmを使用
mroonga 4.0
groonga 4.0
#!/usr/bin/perl
package OneSteam::Agent::Collector;
use strict;
use warnings;
my @func = qw/memory loadavg uptime sys_version processors cpu_usage tcp_established disk_usage disk_io/;
diff --git a/server/server.go b/server/server.go
index 0067cec..79e9ae0 100644
--- a/server/server.go
+++ b/server/server.go
@@ -62,7 +62,7 @@ func (self *Server) getAllJobs() {
}
func (self *Server) Start(addr string) {
- ln, err := net.Listen("tcp", ":4730")
+ ln, err := net.Listen("tcp", addr)
use Kossy;
use Plack::Session;
sub Plack::Session::new {
my ($class, $env) = @_;
my $self = bless {
session => $env->{'psgix.session'},
options => $env->{'psgix.session.options'},
}, $class;
for my $flash_key ( grep { m/^__flash__/ } keys %{$self->session} ) {
@kazeburo
kazeburo / gist:f52c2a962a7d821bac3f
Created September 19, 2014 07:14
simple Plack::Middleware::SizeLimit
use strict;
use warnings;
use Plack::Builder;
my $app = sub {
return [200,[],['OK']];
};
builder {
# ここから
03:39:48 UTC - mysqld got signal 11 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help
diagnose the problem, but since we have already crashed,
something is definitely wrong and this may fail.
key_buffer_size=33554432
read_buffer_size=1048576
@kazeburo
kazeburo / gist:20c29d05d4018c4e7688
Created November 17, 2014 06:38
infinite loop if header has multibyte characters
diff --git a/picohttpparser.c b/picohttpparser.c
index 10015b8..ee9904f 100644
--- a/picohttpparser.c
+++ b/picohttpparser.c
@@ -95,6 +95,7 @@ static const char* get_token_to_eol(const char* buf, const char* buf_end,
if ((likely((unsigned char)*buf < '\040') && likely(*buf != '\011')) || unlikely(*buf == '\177')) {
goto FOUND_CTL;
}
+ ++buf;
}