You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Master-slave synchronization problems on big dbs #957
Hey, thanks for the additional info. I see you are using FreeBSD, this is very likely a FreeBSD specific issue, I probably need some help from you in order to understand what the problem is. To start it would be very helpful if you could do the following:
File syncio.c, in syncRead():
if (nread == -1) {
if (errno != EAGAIN) return -1;
} else {
[83823] 25 Feb 15:11:54.431 # Server started, Redis version 2.6.10
[83823] 25 Feb 15:11:54.431 * The server is now ready to accept connections on port 9876
[83823] 25 Feb 15:12:16.766 * SLAVE OF nebula1:6379 enabled (user request)
[83823] 25 Feb 15:12:17.588 * Connecting to MASTER...
[83823] 25 Feb 15:12:17.590 * MASTER <-> SLAVE sync started
[83823] 25 Feb 15:12:17.591 * Non blocking connect for SYNC fired the event.
[83823] 25 Feb 15:12:17.852 * Master replied to PING, replication can continue...
SYNCREAD: [35 - 35] Resource temporarily unavailable
@bakwc before to continue, it seems realistic to you to be able to provide shell access in the test environment to me? Otherwise if this is not possible I'll create a branch with much more debugging information printed by Redis.
What is strange is that what was supposed to shed some light on the issue was a bit useless as the new error is now in a different part of the code, and apparently the connection is lost while the data transfer is in progress, that I've no idea why it happens at all.
So either I need to directly mess with the code in the system where this happens or to provide a much more debug-intensive version of Redis that you can try to see what happens.
@charsyam in theory this should never happen because the signal handler called us because there is more data to read on the socket, we should be able to read at least a single byte.
no prob at all, however it is possible that we'll find some error in the code as it is unlikely that this is a FreeBSD-specific issue in so well-understood networking code and APIs. Probably I mis-handle something.
@antirez sor, can't provide access ( You may try to reproduce by installing freebsd somewhere and try to sync, but I'm not sure if it is reproduced on little load / memory usage.
You can make version with more debug info, i can use it as master/slave and send you output.
The problem was with little client output buffer for slaves. Full repclication take ~10 minutes, new data in slave buffer was more than 64 mb after ~3 minutes, connection was droped by soft (or hard) limit.
Solved by added this to config:
client-output-buffer-limit slave 4096mb 2048mb 60
I should read documentation carefully next time ^^
Reacted by guizhou-feng, Pavel Skuratovich, Gene Verb, madisonleavo, Phuoc Hoang and Pallav Jha
1467:S22Feb11:12:43.771*MasterrepliedtoPING, replicationcancontinue...
1467:S22Feb11:12:43.775*Partialresynchronizationnotpossible (nocachedmaster)
1467:S22Feb11:12:46.184*Fullresyncfrommaster: 9304d314d029c32e6fe268e9f35c13ec937b0b3e:90771666330261467:S22Feb11:13:47.902# Timeout receiving bulk data from MASTER... If the problem persists try to set the 'repl-timeout' parameter in redis.conf to a larger value.1467:S22Feb11:13:47.902*ConnectingtoMASTERprod-redis-backend01.r4e:96961467:S22Feb11:13:47.906*MASTER<->SLAVEsyncstarted1467:S22Feb11:13:47.907*NonblockingconnectforSYNCfiredtheevent.
1467:S22Feb11:13:47.908*MasterrepliedtoPING, replicationcancontinue...
1467:S22Feb11:13:47.910*Partialresynchronizationnotpossible (nocachedmaster)
1467:S22Feb11:13:51.322*Fullresyncfrommaster: 9304d314d029c32e6fe268e9f35c13ec937b0b3e:90772132956901467:S22Feb11:14:49.534# I/O error reading bulk count from MASTER: Resource temporarily unavailable1467:S22Feb11:14:50.040*ConnectingtoMASTERprod-redis-backend01.r4e:9696
Sometimes, slave is showing timeout and sometimes it is erroring I/O error. updated repl-timeout on redis.conf, but still no luck.
22324:S 06 Mar 04:28:33.119 - Accepted 127.0.0.1:36682
22324:S 06 Mar 04:28:33.120 - Client closed connection
22324:S 06 Mar 04:36:27.053 # I/O error trying to sync with MASTER: connection lost
22324:S 06 Mar 04:36:27.486 * Connecting to MASTER insight:6398
22324:S 06 Mar 04:36:27.487 * MASTER <-> SLAVE sync started
22324:S 06 Mar 04:36:27.584 * Non blocking connect for SYNC fired the event.
22324:S 06 Mar 04:36:27.682 * Master replied to PING, replication can continue...
22324:S 06 Mar 04:36:27.878 * Partial resynchronization not possible (no cached master)
22324:S 06 Mar 04:36:27.993 * Full resync from master: 2bd94361dcad53fa49f5be885520f745668149b9:2387219204099
22324:S 06 Mar 04:36:30.459 * MASTER <-> SLAVE sync: receiving 89603397 bytes from master
Activity
antirez commentedon Feb 19, 2013
Hello, thanks for reporting, please provide INFO output of the master instance. Cheers.
bakwc commentedon Feb 19, 2013
http://pastebin.com/XLE9e954 - it's from test server where failed was reproduced
http://pastebin.com/x0Gx8SG7 - it's from real server under load
antirez commentedon Feb 20, 2013
Hey, thanks for the additional info. I see you are using FreeBSD, this is very likely a FreeBSD specific issue, I probably need some help from you in order to understand what the problem is. To start it would be very helpful if you could do the following:
File syncio.c, in syncRead():
Change it into
After this change try again and send me the output. Thanks!
bakwc commentedon Feb 25, 2013
[83823] 25 Feb 15:11:54.431 # Server started, Redis version 2.6.10
[83823] 25 Feb 15:11:54.431 * The server is now ready to accept connections on port 9876
[83823] 25 Feb 15:12:16.766 * SLAVE OF nebula1:6379 enabled (user request)
[83823] 25 Feb 15:12:17.588 * Connecting to MASTER...
[83823] 25 Feb 15:12:17.590 * MASTER <-> SLAVE sync started
[83823] 25 Feb 15:12:17.591 * Non blocking connect for SYNC fired the event.
[83823] 25 Feb 15:12:17.852 * Master replied to PING, replication can continue...
SYNCREAD: [35 - 35] Resource temporarily unavailable
bakwc commentedon Feb 25, 2013
http://pastebin.com/UQhVvANn here is more detailed. SYNCREAD appears at the same time as "Master replied to PING, replication can continue..."
P. S. I recompiled only slave. Should I do it in master also?
charsyam commentedon Feb 25, 2013
@bakwc @antirez
I think it is because this code in readSyncBulkPayload() in replication.c
charsyam commentedon Feb 25, 2013
@bakwc could you test this code?
charsyam@8de45f8
antirez commentedon Feb 25, 2013
@charsyam it is not possible that the problem is what you stated, so @bakwc does not need to test this code.
If you look at the logs, you'll read:
connection lost is only printed when the return value is 0, that is not what your additional commit handles.
antirez commentedon Feb 25, 2013
@bakwc before to continue, it seems realistic to you to be able to provide shell access in the test environment to me? Otherwise if this is not possible I'll create a branch with much more debugging information printed by Redis.
What is strange is that what was supposed to shed some light on the issue was a bit useless as the new error is now in a different part of the code, and apparently the connection is lost while the data transfer is in progress, that I've no idea why it happens at all.
So either I need to directly mess with the code in the system where this happens or to provide a much more debug-intensive version of Redis that you can try to see what happens.
Thanks!
charsyam commentedon Feb 25, 2013
@antirez . Yes, You're right. but it can also make another problem when EAGAIN happens.
Don't you think so?
antirez commentedon Feb 25, 2013
@charsyam in theory this should never happen because the signal handler called us because there is more data to read on the socket, we should be able to read at least a single byte.
antirez commentedon Feb 25, 2013
Sorry the event handler, not signal.
charsyam commentedon Feb 25, 2013
@antirez Thank you for your teaching. I misunderstand the source.
antirez commentedon Feb 25, 2013
no prob at all, however it is possible that we'll find some error in the code as it is unlikely that this is a FreeBSD-specific issue in so well-understood networking code and APIs. Probably I mis-handle something.
bakwc commentedon Feb 25, 2013
@antirez sor, can't provide access ( You may try to reproduce by installing freebsd somewhere and try to sync, but I'm not sure if it is reproduced on little load / memory usage.
You can make version with more debug info, i can use it as master/slave and send you output.
bakwc commentedon Mar 5, 2013
So, could you make a debug branch please?
bakwc commentedon Apr 21, 2013
The problem was with little client output buffer for slaves. Full repclication take ~10 minutes, new data in slave buffer was more than 64 mb after ~3 minutes, connection was droped by soft (or hard) limit.
Solved by added this to config:
client-output-buffer-limit slave 4096mb 2048mb 60
I should read documentation carefully next time ^^
mouliveera commentedon Feb 22, 2018
We have some issues with redis:
Sometimes, slave is showing timeout and sometimes it is erroring I/O error. updated repl-timeout on redis.conf, but still no luck.
Would you guys suggest for the fix.
weldpua2008 commentedon Mar 6, 2018
Same problem on 4.0.2
2 of 68 Slaves fails with
Slave:
Master
Squashed 'deps/hiredis/' changes from f8de9a4bd..b6a052fe0
Merge pull request redis#957 from Cyan4973/dependabot/github_actions/…