I use odbc to interface mysql. I start odbc by the following code:
ConnectString = "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=mydb; User=userdb;Password=pwddb;Option=3;",case odbc:connect(ConnectString, [{scrollable_cursors,off}]) of ...
After 8 hours of inactivity (more or less), odbc crashs:
=CRASH REPORT==== 22-Jun-2012::02:09:27 === crasher:
initial call: odbc:init/1
pid: <0.113.0>
registered_name: []
exception exit: {stopped,{'EXIT',<0.108.0>,killed}}
in function gen_server:terminate/6 (gen_server.erl, line 737)
ancestors: [odbc_sup,<0.111.0>]
messages: [{'EXIT',#Port<0.967>,normal}]
links: [<0.112.0>]
dictionary: []
trap_exit: true
status: running
heap_size: 377
stack_size: 24
reductions: 2237 neighbours:
Is a connection limited in the time ?
Mysql has a variable wait_timeout that controls how long the server will wait for a client to do something. The default value is 28800 secs. Casually, 28800 secs are 8 hours, so you might want to check that in your server configuration and set it to a larger value.
Other than that, you should let your worker terminate, and have the supervisor restart it as normal. Or (if using a gen_server or gen_fsm) setup a timeout to issue a query or a ping to keep alive the connection every hour or so, to keep the worker alive.
Best!