Skip to content

Instantly share code, notes, and snippets.

View matsumotory's full-sized avatar
🎯

Ryosuke Matsumoto / @matsumotory matsumotory

🎯
View GitHub Profile
@matsumotory
matsumotory / mod_mruby.bug.2012_06_04
Created June 4, 2012 12:37
mod_mruby received signal SIGSEGV by gc_protect.
#0 0x00352c0c in siglongjmp () from /lib/libc.so.6
#1 0x00cca0c3 in mrb_exc_raise (mrb=0xb7718160, c=0xb771d48c, fmt=0xd15264 "arena overflow error") at error.c:185
#2 mrb_raise (mrb=0xb7718160, c=0xb771d48c, fmt=0xd15264 "arena overflow error") at error.c:206
#3 0x00ccaf45 in gc_protect (mrb=0xb7718160, ttype=MRB_TT_STRING, cls=0xb771e7f4) at gc.c:251
#4 mrb_obj_alloc (mrb=0xb7718160, ttype=MRB_TT_STRING, cls=0xb771e7f4) at gc.c:285
#5 0x00cdf2c9 in str_alloc (mrb=0xb7718160, p=0xb6500f63 "/var/www/html/test.html", len=23) at string.c:105
#6 str_new (mrb=0xb7718160, p=0xb6500f63 "/var/www/html/test.html", len=23) at string.c:125
#7 mrb_str_new (mrb=0xb7718160, p=0xb6500f63 "/var/www/html/test.html", len=23) at string.c:214
#8 0x00cc286a in codegen (s=0xb6312520, tree=<value optimized out>, val=1) at codegen.c:1611
#9 0x00cc3d26 in codegen (s=0xb6312520, tree=<value optimized out>, val=0) at codegen.c:1154
@matsumotory
matsumotory / gist:2873356
Created June 5, 2012 07:39 — forked from tsuzakiyo/gist:2872532
mrb_fixnum_value_sample.c
#include <mruby.h>
#include "mruby/string.h"
#include "mruby/proc.h"
#include "mruby/compile.h"
struct RClass *class;
struct RClass *class_int;
mrb_value mrb_num_init(mrb_state *mrb, mrb_value str);
mrb_value ap_mrb_get(mrb_state *mrb, mrb_value str);
@matsumotory
matsumotory / mruby_int_bug.c
Created June 5, 2012 08:12
mruby Bug? mruby cannot output int variables by mrb_define_method.
/*
gcc -I mruby/include -I mruby/src -O3 -g -Wall -Werror-implicit-function-declaration mruby_int_bug.c -lm mruby/mrblib/mrblib.o -lm mruby/lib/libmruby.a
*/
#include <string.h>
#include "mruby.h"
#include "mruby/proc.h"
#include "mruby/compile.h"
mrb_value mrb_num_get(mrb_state *mrb, mrb_value str)
@matsumotory
matsumotory / mruby_int_bug.c
Created June 6, 2012 05:45
using mrb_class_define_method.
/*
gcc -I mruby/include -I mruby/src -O3 -g -Wall -Werror-implicit-function-declaration mruby_int_bug.c -lm mruby/mrblib/mrblib.o -lm mruby/lib/libmruby.a
*/
#include <string.h>
#include "mruby.h"
#include "mruby/proc.h"
#include "mruby/compile.h"
mrb_value mrb_num_get(mrb_state *mrb, mrb_value str)
@matsumotory
matsumotory / install-apache-2.5.sh
Created July 23, 2012 07:04
Install Apache 2.5.0?
#!/bin/sh
# error exit code is line number
INSTALLDIR='/usr/local/apache250'
WORK='./apache-work'
COPT="--prefix=$INSTALLDIR --with-apr=srclib/apr --with-apr-util=srclib/apr-util"
REPO='git://github.com/matsumoto-r/httpd.git'
echo "Start: Apache 2.5.0 install to $INSTALLDIR"
@matsumotory
matsumotory / gist:3666324
Created September 7, 2012 13:38
mod_mruby segfault on mrb_run.
Program received signal SIGSEGV, Segmentation fault.
mrb_run (mrb=0xb59faa78, proc=0xb59fd94c, self=...) at vm.c:446
446 mrb_code *pc = irep->iseq;
(gdb)
(gdb) where
#0 mrb_run (mrb=0xb59faa78, proc=0xb59fd94c, self=...) at vm.c:446
#1 0xb7d3ac5d in ap_mruby_run (mrb=0xb59faa78, r=0xb5817be0, conf=0xb7e02158, mruby_code_file=0xb58195f0 "/var/www/html/test.mrb", module_status=0) at mod_mruby.c:995
#2 0xb7d3bda1 in mod_mruby_handler (r=0xb5817be0) at mod_mruby.c:1068
#3 0x0055ce9d in ap_run_handler ()
#4 0x00560863 in ap_invoke_handler ()
@matsumotory
matsumotory / gist:3765572
Created September 22, 2012 08:44
Traffic exceeded tweet by mod_mruby
##
# SimpleURI
class SimpleURI
PARAMS_ORDER = [:scheme, :userinfo, :host, :port, :registry, :path, :opaque, :query, :fragment]
def initialize(*args)
args = SimpleURI.split(args.first) if args.length == 1
@uri = {}
args.each_index{|idx|
@matsumotory
matsumotory / gist:4194067
Created December 3, 2012 10:20
redis by mod_mruby
r = Apache::Request.new()
r.content_type = "text/html"
a = Apache
host = "127.0.0.1"
port = 6379
a.rputs("> redis connect " + host + ":" + port.to_s + "<br>")
redis = Apache::Redis.new(host, port)
key="hoge"
@matsumotory
matsumotory / gist:4233321
Created December 7, 2012 13:36
SIGABRT of mod_mruby by mruby/mruby f521738953b9297a4d26e68ec42b7e9a22e5b442
Program received signal SIGABRT, Aborted.
0x00c8e402 in __kernel_vsyscall ()
(gdb) where
#0 0x00c8e402 in __kernel_vsyscall ()
#1 0xb7ec0df0 in raise () from /lib/libc.so.6
#2 0xb7ec2701 in abort () from /lib/libc.so.6
#3 0xb7cec784 in mrb_exc_raise () from /usr/lib/httpd/modules/mod_mruby.so
#4 0xb7ceca9a in mrb_raise () from /usr/lib/httpd/modules/mod_mruby.so
#5 0xb7cee99e in mrb_obj_alloc () from /usr/lib/httpd/modules/mod_mruby.so
#6 0xb7cf8a4c in mrb_proc_new_cfunc () from /usr/lib/httpd/modules/mod_mruby.so
@matsumotory
matsumotory / gist:4274538
Created December 13, 2012 06:33
mruby-http SIGSEGV on h.parse_request
(gdb) r http.rb
Starting program: DEV/mruby-http/example/runner http.rb
warning: .dynamic section for "/lib/libc.so.6" is not at the expected address
warning: difference appears to be caused by prelink, adjusting expectations
[Thread debugging using libthread_db enabled]
http
localhost
8080
/foo
bar=baz