Tag Archives: error

Obscure mysql bug number 1153 (08S01) (my packet’s too big)

Ok, here’s one you don’t see every day.

Importing a mysql dumpfile results in “ERROR 1153 (08S01) at line 265: Got a packet bigger than ‘max_allowed_packet’ bytes”

Errm.

Log in to a mysql console,

enter the magic commands:

set global net_buffer_length=1000000;

set global max_allowed_packet=1000000000;

Modify your import to include the command:

–max_allowed_packet=100M

so you have something like

mysql –max_allowed_packet=100M -u user -p db_name < dump.sql

Try again

Your mileage may vary ( do they say kilometerage elsewhere?) so increase the allowed sizes if you have to.

Taming the Savage Beast (Forums)

We needed a forum for one of our web projects written in rails and a quick google revealed Savage Beast.  It seemed to fit the bill although needed some css tweeks to co-exist with what we currently have.  However, when clicking on its RSS feed icon it threw an ActionController::Request.relative_url_root method missing error which was fixed by creating the class request_error.rb in initializers with the code below:

class ActionController::Request
def relative_url_root
@@relative_url_root ||= case
when @env["RAILS_RELATIVE_URL_ROOT"]
@env["RAILS_RELATIVE_URL_ROOT"]
when server_software == ‘apache’
@env["SCRIPT_NAME"].to_s.sub(/\/dispatch\.(fcgi|rb|cgi)$/, ”)
else

end
end
end

Based on bug reported here: http://railsforum.com/viewtopic.php?pid=73991#p73991.

It all seems to work fine now.

Sending lots of data using Post and Rails (ie. avoid URI too long error)

I was having problems with a link to remote that I had encoded as follows:

link_to_remote ‘Variable’, :url=> sort_variables_surveys_url(:sorted_variables=>sorted_variables, :search_query=>query, :survey_list => years, :sort => key)

The sorted_variables param was far too big in some cases and returning a ‘uri too long’ error.  So I scratched my head for a while and then looking at the link_to_remote docs more closely showed that if I wrapped the ‘sorted_variables’ up inside a div like so:

<div id=”sorted_variables”>

<% sorted_variables.each do |variable| -%>

<%= hidden_field_tag “sorted_variables[]”, variable.id.to_s -%>

<% end -%>

</div>

and then added :submit => ‘sorted_variables’ to the link_to_remote call like this:

link_to_remote ‘Variable’, :submit=> ‘sorted_variables’, :url=> sort_variables_surveys_url(:search_query=>query, :survey_list => years, :sort => key)

then it all seems to work fine.