[R-sig-DB] RMySQL doesn't auto-reconnect
Jack Tanner
|hok @end|ng |rom hotm@||@com
Fri Aug 28 19:07:30 CEST 2009
Unfortunately, the server in question is on a web host, so I almost
certainly have no control of time-out parameters, even just to play with
to test the hypothesis. The loss of connection usually happens within
seconds, not even tens of seconds. Connecting from a different client
machine still results in "server has gone away."
I agree that auto-reconnect is a kludge, but I don't really know how to
diagnose the failure of the connection. Ideas welcome. :)
Could you clarify why auto-reconnect is dangerous security-wise?
Paul Gilbert wrote:
> Jack
>
> It is possible this is a firewall, but I think there is also a
> connection timeout parameter on the server, which can be adjusted. I'm
> not sure what the default is, but I don't usually have trouble unless
> I leave a connection sitting idle overnight. Probably the firewall has
> some sort of connection timeout too. I think both these timeouts
> should depend on idle time, so are not consistent with the problem you
> report.
>
> Auto-reconnect would fix your problem, but I don't think you should be
> getting dropped in the first place, unless you are really leaving the
> connection idle for a long time. If you are doing that, I would not
> recommend auto-reconnect (for security reasons).
>
> Paul
>
> Jeffrey Horner wrote:
>> Jack Tanner wrote:
>>
>>> After I do library(RMySQL), dbConnect(), and run a few queries, I
>>> sometimes get this:
>>>
>>> Error in mysqlExecStatement(conn, statement, ...) :
>>> RS-DBI driver: (could not run statement: MySQL server has gone away)
>>>
>>> If I issue a dbConnect() again, I can run queries again ... for a
>>> little while, and then I get another "server has gone away".
>>>
>>> The MySQL server is on a separate machine from the client. It's
>>> entirely possible that there's one or more firewalls in between,
>>> which could be causing the problem. The
>>>
>>> I understand that MySQL has auto-reconnect functionality:
>>>
>>> http://blog.taragana.com/index.php/archive/how-to-enable-disable-auto-reconnect-in-mysql/
>>>
>>>
>>> Does RMySQL allow me to turn on auto-reconnect? If so, how?
>>
>>
>> Unfortunately it doesn't right now, but that would be a great
>> addition. I've often had to test for the connection going away for
>> unknown reasons as well.
>>
>> I'll pencil it in for the next release as it's easy to add.
>>
>> Jeff
>>
>>>
>>> > version
>>> _ platform
>>> i386-redhat-linux-gnu arch i386
>>> os linux-gnu system i386,
>>> linux-gnu status
>>> major 2 minor
>>> 9.1 year 2009
>>> month 06 day
>>> 26 svn rev 48839
>>> language R version.string R version
>>> 2.9.1 (2009-06-26)
>>> > mysqlClientLibraryVersions()
>>> 5.0.45 5.0.45
>>> 50045 50045
More information about the R-sig-DB
mailing list