20120131-fix-errors-oddb_org-recycled-object-error-migel-check-grid_c
<< Masa.20120210-fix-quanty-error-pointer-url-bsv-errors-oddb_org-french-fi-ebook | Index | Masa.20120130-update_company_textinfos2-oddb_org >>
- Fix errors oddb.org
- Check grid.c
- Commits
-
- Skip limitation_text method if there is no limitation_text. Fix NoMethodError undefined method [] for nil NilClass (oddb.org)
- Rescued NoMethodError undefined method migel_code for 1.9:String (migel)
- Fix ArgumentError comparison of ODDB::State::Interactions::Basket::Check with ODDB::State::Interactions::Basket::Check failed when sorting in interaction_basket event (oddb.org)
- Fix NoMethodError undefined method each for nil:NilClass when sorting result by price_public (oddb.org)
- Fix Encoding::CompatibilityError incompatible encoding regexp match (UTF-8 regexp with ASCII-8BIT string) (oddb.org)
- Fix NoMethodError undefined method generic_group_comparables for nil:NilClass in ddd_chart event (oddb.org)
Fix errors oddb.org
Refer to
#!/bin/sh
exec 2>&1
ulimit -v 10240000
exec sudo -u apache envdir /home/ywesee/env /usr/local/bin/ruby /var/www/migel/bin/migeld
- /home/ywesee/RUBY_GC_MALLOC_LIMIT
70000000
- Default value is 8000000
- With the default RUBY_GC_MALLOC_LIMIT (8000000), averagely 10 times reloading causes the recycled object error
Check grid.c
Note
- Most of the crash cases come from
- grid.c#grid_add_component_stype (composite.rb: 227)
- grid.c#grid_to_html (composite.rb 164)
- The last executed line in the case of composite.rb 227 is (grid.c 853, in grid_add_attribute)
if(rb_respond_to(item, set_attribute))
- The item.class could be (the followings are from top page of ch.oddb.org)
- item.class = ODDB::View::TabNavigationLink
- item.class = ODDB::View::TabNavigation
- item.class = HtmlGrid::Input
- item.class = HtmlGrid::Span
- item.class = String
- item.class = ODDB::View::NavigationLink
- item.class = HtmlGrid::Link
- item.class = ODDB::View::CountryNavigation
- item.class = ODDB::View::ZoneNavigation
- item.class = ODDB::View::Copyright
- item.class = ODDB::View::Navigation
- These instances are checked if they have 'set_attribute' method by the 'rb_respond_to' function
How to check item.class
- /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.4/ext/htmlgrid/grid.c#grid_field_add_component_style
...
VALUE val;
char *value;
val = rb_funcall(item, rb_intern("class"), 0);
val = rb_funcall(val, rb_intern("to_s"), 0);
value = StringValuePtr(val);
printf("item.class = %s\n", value);
if(rb_respond_to(item, set_attribute))
...
- sudo /usr/local/bin/ruby extconf.rb
- sudo make clean; make
Experiment
- /usr/local/lib/ruby/gems/1.9.1/gems/htmlgrid-1.0.4/ext/htmlgrid/grid.c#grid_field_add_component_style
void grid_field_add_component_style(cf, style)
...
//if(rb_respond_to(item, set_attribute))
if(rb_respond_to("hogehoge", set_attribute))
{
rb_funcall(item, set_attribute, 2,
str_class, style);
}
Result
Next
- Where is the 'item' coming from?
- Catch it on Ruby level before grid.c
Memo (useful to check class of VALUE type variable)
char *which_class(VALUE item){
VALUE val;
char *value;
val = rb_funcall(item, rb_intern("class"), 0);
val = rb_funcall(val, rb_intern("to_s"), 0);
value = StringValuePtr(val);
return value;
}
- The followings is available to check data type in C level
Note
- cf comes from cg->fields[]
- cg is a cGrid struct data
- cg->fields may change in grid_set_dimensions or grid_insert_row function
- grid_insert_row may be called from Ruby level with insert_row method