I have the same problem in 5.5.43. I was having the "has gone away" error message for some long queries beyond about 2 minutes. So I tried these 3:
(1) SHOW VARIABLES LIKE 'wait_%';
(2) SHOW global VARIABLES LIKE 'wait_%'; and
(3) SHOW session VARIABLES LIKE 'wait_%'; .
All showed wait_timeout to be 28800. Then I added wait_timeout = 31536000 to /etc/my.cnf. Then my long query was able to complete. And from the 3 ways of showing variables above, only (2) the one with "global" showed a change from 28800 to 31536000. The other 2 were unaffected. Since my long-query was definitely less than 10 minutes long, does this mean that the unit of time used here was milliseconds rather than seconds?