Rails - Mysql::ProtocolError: invalid packet [duplicate] - mysql

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Perplexing Ruby/MySQL Error: "invalid packet: sequence number mismatch"
My rails app just started having these strange MySQL errors on my EC2/RDS stack.
I've tried several versions of ruby 1.9.2 as well as REE 1.8.7.
What's the deal with this ProtocolError? This doesn't happen on any of my other sites or my local machine.
I can delete some data from my site and the query will work for a couple of page views then it breaks again :(
I'm using Phusion with Apache.
with version gem 'ruby-mysql', "2.9.4"
ActiveRecord::StatementInvalid in TricksController#index
Mysql::ProtocolError: invalid packet: sequence number mismatch(103 != 29(expected)): SELECT `tricks`.* FROM `tricks`
And with version gem 'ruby-mysql', "2.9.3"
Mysql::ProtocolError (invalid packet: f1="\x0F\xC0\x15\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"):

Duplicate of: Perplexing Ruby/MySQL Error: "invalid packet: sequence number mismatch"
My Rails 3.0.4 app started working with ruby-mysql 2.9.3.

Related

HTML report generation error in Jmeter 5.4.3 [duplicate]

This question already has answers here:
Error while generating report in apache-jmeter-5.4.1.tgz
(5 answers)
Closed 1 year ago.
I am unable to generate the html report from the results .jtl file. I have jdk 17 on my machine and while giving the jmeter command to generate the report is giving me the below error message.
"An error occurred: Error while processing samples: Consumer failed with message :Consumer failed with message :Consumer failed with message :Consumer failed with message :Begin size 2 is not equal to fixed size 5"
This issue is due to the use of JDK 17 which is not supported by JMeter 5.4.3.
This bug is identified under:
https://bz.apache.org/bugzilla/show_bug.cgi?id=65685
It is fixed in nightly build.
So you have 2 options:
Use JDK < 17
Use nightly build from here: https://ci.apache.org/projects/jmeter/nightlies/
The JMeter 5.5 release will be compatible with JDK 17.

java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory

I just started receiving this error today, on a Tomcat 8 installation. Possibly, the error started after updating Tomcat 8 to the latest version.
java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory
Where do I find this class -- as in, what JAR is it in, and where do I get that jar?
My data source is set up exactly like the examples given in many Tomcat tutorials. Specifically, the factory is "org.apache.commons.dbcp.BasicDataSourceFactory" and the driverClassName is "com.mysql.jdbc.Driver".
This was all working fine when I set it up a few weeks ago. Nothing changed other than possibly I did a "yum update" earlier today.
Use this link for version 8.
I also have this link on my notes for version 7.

libgcc_s_dw2-1.dll contains an error

I have been using Octave 4.03 for about a year on Windows 10 platform.
All at a sudden, when I was trying to launch Octave GUI as usual, I recieved the following error message:
File libgcc_s_dw2-1.dll is either not designed to run on Windows or it contains an error. Try installing the program again using the original installation media or contact administrator. Error status: 0xc0000020.
Any help how to fix this problem?

Ruby - Exception occured: [Mysql2::Error] closed MySQL connection

I have a Rails application now only runs internally, so there's not so much visits right now. And there're two resque worker running hardly to fetch data from the web and inserts into a mysql database, every insert will followed by sleep 10 second.
We run it on a VPS. After like every 5 hours, I will encounter an Exception Exception occured: [Mysql2::Error] closed MySQL connection".
What could be the reason causing the exception? Now the pool size is 5.
Will it help if I raise the pool size and specify reconnect: true in my database.yml?
This is a common issue when using the mysql2 gem version 0.2.11 or below in combination with multithreading. There is a bug on the issue tracker with a details on the problem but in conclusion the advice is to:
Update the gem version you are using to >= 0.2.12
Add the reconnect: true option your db connection config in the database.yml file
You probably already solved your problem but this might help others who come across this question.
If your workers are inactive for a long period of time, they'll lose their MySQL connection.
see here for the solution
or just stick this in an initializer
unless Rails.env.to_s == 'test'
module ActiveRecord::ConnectionAdapters
class Mysql2Adapter
alias_method :execute_without_retry, :execute
def execute(*args)
execute_without_retry(*args)
rescue Exception => e
if e.message =~ /server has gone away/i
warn "Server timed out, retrying"
reconnect!
retry
else
raise e
end
end
end
end
end
More insight on how to debug this for delayed_job. I did the following after setting reconnect: true on database.yml, and this solution not working.
cd /your_rails_deploy_code/log
cat production.log
# check the pids from delayed job:
E, [2017-02-01T19:45:21.614579 #2592] ERROR -- : 2017-02-01T19:45:21+0000: [Worker(delayed_job.3 host:demeter pid:2592)] Job ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper (id=193675) FAILED (0 prior attempts) with Mysql2::Error: closed MySQL connection
On my specific case, pid:2592 is the only one constantly failing. Why? Let's find out:
[deploy#demeter] ps -ef | grep 2592
deploy 2592 1 0 Jan31 ? 00:00:40 production/delayed_job.3
deploy 23312 1 0 Feb01 ? 00:00:40 production/delayed_job.1
deploy 23318 1 0 Feb01 ? 00:00:40 production/delayed_job.0
I noticed that specific process started days before my latest deploy. As soon as I killed it, the errors were gone. What I assume happened on my specific case was that my latest deploy did not delete all delayed_job instances correctly.

Need help with perl error in using DBD::mysql [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Need help with perl error in using DBD::mysql
When I run a perl script which uses DBD::mysql , I get the error message:
install_driver(mysql) failed: Can't load '/home/y/lib/perl5/site_perl/5.8/i686-linux-64int/auto/DBD/mysql/mysql.so' for module DBD::mysql: libmysqlclient.so.16: cannot open shared object file: No such file or directory at /home/y/lib/perl5/5.8/i686-linux-64int/DynaLoader.pm line 230.
at (eval 30) line 3
I am new to perl, but from what I understand it needs mysql.so and it knows the path.
/home/y/lib/perl5/site_perl/5.8/i686-linux-64int/auto/DBD/mysql/mysql.so is present.
Then why the problem?
The file that is missing is libmysqlclient.so.16. It comes with the mysqlclient package on some distributions.
Also, Make sure /etc/ld.so.conf contains /usr/local/mysql/lib/mysql and /usr/local/mysql/ . If not, add them and run ldconfig.