Skip to content

Reconnect to DB after timeout for Notify command. Fixes #14479 - #14480

Merged
rullzer merged 3 commits into
nextcloud:masterfrom
ariselseng:reconnect-db-notify
Mar 4, 2019
Merged

Reconnect to DB after timeout for Notify command. Fixes #14479#14480
rullzer merged 3 commits into
nextcloud:masterfrom
ariselseng:reconnect-db-notify

Conversation

@ariselseng

@ariselsengariselseng commented Mar 3, 2019

Copy link
Copy Markdown
Member

Fix#14479

Every 8th hour I got a "2006 Mysql server has gone away". It was due to a 8 hour wait_time.
Since the Notify command should be running 24/7 increasing wait_time won't help much. Change events that triggers this never get registered and filecache will be wrong/out of sync.

This PR makes it reconnect in case of timeout. I borrowed the reconnect logic from:

protectedfunctionreconnectToDatabase(OutputInterface$output) {

I also needed to move updateQuery to a method due to it being a prepared statement from a dead connection and it needed to be remade after reconnect.

Comment threadapps/files_external/lib/Command/Notify.php
Comment threadapps/files_external/lib/Command/Notify.php
@MorrisJobkeMorrisJobke added this to the Nextcloud 16 milestone Mar 4, 2019
@MorrisJobke

Copy link
Copy Markdown
Member

Mind to add the sign-off message to your last commit: https://github.com/nextcloud/server/pull/14480/checks?check_run_id=72120851

Signed-off-by: Ari Selseng <ari@selseng.net>
@ariselseng

Copy link
Copy Markdown
MemberAuthor

@MorrisJobke woops. Done!

Comment threadapps/files_external/lib/Command/Notify.php Outdated
Signed-off-by: Ari Selseng <ari@selseng.net>

@MorrisJobkeMorrisJobke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good 👍

@rullzer
rullzer merged commit 243bc96 into nextcloud:masterMar 4, 2019
@icewind1991

Copy link
Copy Markdown
Member

/backport to stable15

@icewind1991

Copy link
Copy Markdown
Member

/backport to stable14

@backportbot-nextcloud

Copy link
Copy Markdown

backport to stable15 in #15006

@backportbot-nextcloud

Copy link
Copy Markdown

backport to stable14 in #15007

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@ariselseng@MorrisJobke@icewind1991@kesselb@rullzer