#463 [mod_log_messages_sql] Does not reconnect to database
Reporter
justinchaisejmc1
Owner
Zash
Created
Updated
Stars
★★ (3)
Tags
Priority-Low
Status-WontFix
Type-Defect
Component-Community
justinchaisejmc1
on
*What steps will reproduce the problem?*
1.cold boot or pc restart.
2.log rotate at night
3.users clients start logging in in the morning.
*What is the expected output? What do you see instead?*
expected output = nothing in error logs
actual output:
Jan 28 07:36:22 mod_c2s error Traceback[c2s]: /usr/lib/prosody/modules/mod_log_messages_sql.lua:82: connection failed
stack traceback:
.........
Jan 28 07:37:43 mod_c2s error Traceback[c2s]: /usr/lib/prosody/modules/mod_log_messages_sql.lua:81: attempt to index upvalue 'connection' (a nil value)
stack traceback:
.........
and more, see file uploads.
*What version of the product are you using? On what operating system?*
Ubuntu server 14 lts
Lua 5.1
Prosody 0.9.7
lua -e 'print(require"luaevent"._VERSION)' = 0.4.4
MySql 5.5.41-0ubuntu0.14.04.1
mod_log_messages_sql.lua (newest as of 2015 01 28)
*Please provide any additional information below.*
Every morning when i come into work i must restart prosody. (sudo /etc/init.d/prosody restart)
After a pc reboot or cold start i must restart prosody. (sudo /etc/init.d/prosody restart)
The service is still running and status messages are still passed between clients, but no messages are.
After I restart the service it works all day long.
I am using mod_log_messages_sql to archive all messages in MySql.
(prosody.prosodyarchive)
I store roster and vcard info in MySql.
(prosody.prosody)
More info:
After log rotate, service is still running. Clients can log in, MySql auth.
Status announcements are sent to/from the server without error.
When the first message is sent between clients is when the error msg appears in the error log.
Service is still running and status announcements are still sent, but no messages are sent between clients.
Messages are archived in MySql.
dansinex
on
I have the same problem with you,
I am not sure what happend with prosody,
Any suggestion ?
justinchaisejmc1
on
I ended up with a hack to make it work for me by setting a cron job to restart prosody in the morning before work starts. Not a clean fix but its working.
I think it is after the log rotate. it must be losing its connection the the mysql server and it is not able to reconnect.
... and on the cold boot or even warm boot
I think it has to do with the start-up sequence.
mysql should be running before prosody is started (?)
I still have to remember to restart prosody manually on reboot...
I use mysql for authentication (prosody.prosody) and to archive all messages. (prosody.prosodyarchive).
Perhaps one of those smart prosody programmers could add code to the mysql use/connect function.
If the connect fails re-establish the connection. (?)
And then again it could be something totally unrelated to the database.
Except for this I really like the prosody server, it does everything I need it to.
dansinex
on
Hi,
I think the problem come from Mysql.
By default, Mysql auto close the inactive connections.
After 8 hours of in-active, Connection will be closed,
I am going to fix the modules and let you know later,
Zash
on
The solution here is to use the new SQL code in 0.10, however that would mean this 3rd party module would no longer work with 0.9.x, so I think I'll wait until after the 0.10 release with that.
Pretty much all SQL using modules have this problem with 0.9.x unless they implement reconnection themselves.
Changes
owner Zash
titlemust restart prosody after cold boot. [mod_log_messages_sql] Does not reconnect to database
*What steps will reproduce the problem?* 1.cold boot or pc restart. 2.log rotate at night 3.users clients start logging in in the morning. *What is the expected output? What do you see instead?* expected output = nothing in error logs actual output: Jan 28 07:36:22 mod_c2s error Traceback[c2s]: /usr/lib/prosody/modules/mod_log_messages_sql.lua:82: connection failed stack traceback: ......... Jan 28 07:37:43 mod_c2s error Traceback[c2s]: /usr/lib/prosody/modules/mod_log_messages_sql.lua:81: attempt to index upvalue 'connection' (a nil value) stack traceback: ......... and more, see file uploads. *What version of the product are you using? On what operating system?* Ubuntu server 14 lts Lua 5.1 Prosody 0.9.7 lua -e 'print(require"luaevent"._VERSION)' = 0.4.4 MySql 5.5.41-0ubuntu0.14.04.1 mod_log_messages_sql.lua (newest as of 2015 01 28) *Please provide any additional information below.* Every morning when i come into work i must restart prosody. (sudo /etc/init.d/prosody restart) After a pc reboot or cold start i must restart prosody. (sudo /etc/init.d/prosody restart) The service is still running and status messages are still passed between clients, but no messages are. After I restart the service it works all day long. I am using mod_log_messages_sql to archive all messages in MySql. (prosody.prosodyarchive) I store roster and vcard info in MySql. (prosody.prosody)
AttachmentsMore info: After log rotate, service is still running. Clients can log in, MySql auth. Status announcements are sent to/from the server without error. When the first message is sent between clients is when the error msg appears in the error log. Service is still running and status announcements are still sent, but no messages are sent between clients. Messages are archived in MySql.
I have the same problem with you, I am not sure what happend with prosody, Any suggestion ?
I ended up with a hack to make it work for me by setting a cron job to restart prosody in the morning before work starts. Not a clean fix but its working. I think it is after the log rotate. it must be losing its connection the the mysql server and it is not able to reconnect. ... and on the cold boot or even warm boot I think it has to do with the start-up sequence. mysql should be running before prosody is started (?) I still have to remember to restart prosody manually on reboot... I use mysql for authentication (prosody.prosody) and to archive all messages. (prosody.prosodyarchive). Perhaps one of those smart prosody programmers could add code to the mysql use/connect function. If the connect fails re-establish the connection. (?) And then again it could be something totally unrelated to the database. Except for this I really like the prosody server, it does everything I need it to.
Hi, I think the problem come from Mysql. By default, Mysql auto close the inactive connections. After 8 hours of in-active, Connection will be closed, I am going to fix the modules and let you know later,
The solution here is to use the new SQL code in 0.10, however that would mean this 3rd party module would no longer work with 0.9.x, so I think I'll wait until after the 0.10 release with that. Pretty much all SQL using modules have this problem with 0.9.x unless they implement reconnection themselves.
Changesmust restart prosody after cold boot.[mod_log_messages_sql] Does not reconnect to databaseMilestone-0.10Milestone-After0.10 Status-BlockedPerhaps it would be easier to recommend using the standard MAM module along with https://modules.prosody.im/mod_readonly.html for restricting access to the configuration.
https://hg.prosody.im/prosody-modules/rev/b74c86d137c9 Seems like a waste to duplicate parts of mod_storage_sql and mod_mam when those can be configured for this use case.
ChangesMilestone-After0.10Status-WontFix