Solved

MYSQL ERROR 1160 error writing communication packets

Posted on 2014-11-01
7
1,796 Views
Last Modified: 2014-11-03
Dear experts,

I just received an error from MySQL with error 1160 'error writing communication packets'.
I have a stored procedure that does this:
step 1: compares the data from two tables and insert into a tmp table.
step 2: Results from tmp table will then copied over to a table with FEDERATED engine. This Federated table is connected to another table on a different server.

I wish to know if there is anything wrong with step 1 or 2 from above that may cause this error?  The error does not always pop up. Once in a while it will  pop up but is random. I also wish to know if this error will cause major data integrity issue or errors in my data. Thanks
0
Comment
Question by:Kinderly Wade
  • 4
  • 3
7 Comments
 
LVL 15

Expert Comment

by:Insoftservice
ID: 40417581
Please provide stored procedure code if possible

http://www.experts-exchange.com/OS/Linux/Distributions/Q_27092356.html
0
 

Author Comment

by:Kinderly Wade
ID: 40417866
My code is like this:

FIRST PART of the QUERY:
INSERT INTO tmp_tbl
SELECT i.item, i.price, i.qty, i.disc, i.sku, i.loc
FROM (SELECT id, item, price, qty, disc, sku, loc
            FROM inventory) i
LEFT JOIN List l ON i.id = l.id
WHERE l.id IS NULL;
//above will take care of any new items been added to the product line

SECOND PART of QUERY:

TRUNCATE online.online_list;
//online_list is a FEDERATED table which is similar to the online_list data table from the online server.
//this will truncate all data from online_list table

INSERT INTO online.online_list
SELECT * FROM tmp_tbl
//this simply copies any new item added to the product line from tmp_tbl and insert those items into online_list data table.
0
 
LVL 15

Accepted Solution

by:
Insoftservice earned 500 total points
ID: 40417886
Issue may happen even if FEDERATED tables are not actually replicated (FEDERATED turned ON, but database which contains FEDERATED tables excluded using any of the repliate* or binlog* do/ignore options).

Did you checked the link provided its majorly timeout issue

I would try increasing (temporarily) your net_read_timeout, net_write_timeout, and max_allowed_packet variables. When reloading a mysqldump file dies, it's generally caused by one of those.

Inserting too many data can even give you the error

Try to set the max_allowed_packet to 256M, you can add it to /etc/my.cnf or my.ini


[mysqld]
max_allowed_packet=256M

SET GLOBAL max_allowed_packet = 1024 * 1024 * 256;
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:Kinderly Wade
ID: 40417920
Hi insoftservice,

I've noticed that if update didn't trigger for a long period of time and when it updates, the error comes out. If there is a consistant update then the error will not always pop up. It will ususally pop up on the initial attempt when the data hasn't been updated for a while.

I think mostly the timeout issue is causing the problem. I will try to set the pack size and see if I can increase the time out settings.

Thanks. Yes I did take a look at the link.
0
 
LVL 15

Expert Comment

by:Insoftservice
ID: 40418240
Was there any success after doing it
0
 

Author Comment

by:Kinderly Wade
ID: 40418515
I am trying to reconfigure the time_out of federated table (if there is any). Although errors popped out but it doesn't affect the result of my updates. Update is successful although the error pops out. If the system consistently updating then that error will not show up.

Is there a way to disable the error? I am not sure if I extend the timeout will be a good idea because the time out setting maybe there for a good reason.

let me know what you think. Thanks.
0
 

Author Closing Comment

by:Kinderly Wade
ID: 40420958
Hi insofotservice,

When I bring my code to my work place and test it out, it works without error. Suppose maybe the business connection is different from a home connection.

I will try to figure it out. For now no errors has popping up when I used the business connection.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Foreword This is an old article.  Instead of using the MySQL extension that was used in the original code examples, please choose one of the currently supported database extensions instead.  More information is available here: MySQLi / PDO (http://…
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now