Home / GitHub Page

Unable to sync, reason : socket hang up

#1

Hello,
I run Joplin on my desktop, smartphone and laptop. Sync is done with Nextcloud. It works well on desktop and smartphone, but keeps failing on laptop (running Ubuntu).
Nextcloud webdav URL, username and password have been checked and checked again, so it can considered as good !
Here is the log extract :
2019-03-07 15:48:45: “Profile directory: /home/pascal/.config/joplin-desktop”
2019-03-07 15:48:45: “Trying to load 0 master keys…”
2019-03-07 15:48:45: “Loaded master keys: 0”
2019-03-07 15:48:45: “Reducer action”, “SETTING_UPDATE_ALL”
2019-03-07 15:48:45: “Refreshing notes:”, “null”, “null”
2019-03-07 15:48:45: “Reducer action”, “NOTE_UPDATE_ALL, “{“options”:{“order”:[{“by”:“user_updated_time”,“dir”:“DESC”}],“uncompletedTodosOnTop”:true,“showCompletedTodos”:true,“caseInsensitive”:true},“parentId”:null}””
2019-03-07 15:48:45: “Reducer action”, "NOTE_SELECT, "
2019-03-07 15:48:45: “ResourceFetcher: Auto-added resources: 0”
2019-03-07 15:48:45: “Trying to load 0 master keys…”
2019-03-07 15:48:45: “Loaded master keys: 0”
2019-03-07 15:48:45: “Reducer action”, “MASTERKEY_REMOVE_NOT_LOADED”
2019-03-07 15:48:45: “Scheduling sync operation…”
2019-03-07 15:48:45: “Setting up recurrent sync with interval 300”
2019-03-07 15:48:45: “Reducer action”, “FOLDER_UPDATE_ALL”
2019-03-07 15:48:45: “Reducer action”, “TAG_UPDATE_ALL”
2019-03-07 15:48:45: “Reducer action”, “MASTERKEY_UPDATE_ALL”
2019-03-07 15:48:45: “Reducer action”, “FOLDER_SELECT, e32822dadc1a41f5826b29ea9f3ea74e”
2019-03-07 15:48:45: “Reducer action”, “FOLDER_SET_COLLAPSED_ALL”
2019-03-07 15:48:45: “Reducer action”, “LOAD_CUSTOM_CSS”
2019-03-07 15:48:45: “Scheduling sync operation…”
2019-03-07 15:48:46: “Reducer action”, “APP_STATE_SET”
2019-03-07 15:48:46: “Reducer action”, “WINDOW_CONTENT_SIZE_SET”
2019-03-07 15:48:46: “Reducer action”, “NOTE_VISIBLE_PANES_SET”
2019-03-07 15:48:46: “Reducer action”, “SIDEBAR_VISIBILITY_SET”
2019-03-07 15:48:46: “Reducer action”, “APP_STATE_SET”
2019-03-07 15:48:46: “Reducer action”, “SETTING_UPDATE_ONE”
2019-03-07 15:48:46: “Refreshing notes:”, “2”, “e32822dadc1a41f5826b29ea9f3ea74e”
2019-03-07 15:48:46: “Reducer action”, “NOTE_UPDATE_ALL, “{“options”:{“order”:[{“by”:“user_updated_time”,“dir”:“DESC”}],“uncompletedTodosOnTop”:true,“showCompletedTodos”:true,“caseInsensitive”:true},“parentId”:“e32822dadc1a41f5826b29ea9f3ea74e”}””
2019-03-07 15:48:46: “Reducer action”, “NOTE_SELECT, 17128b90291a4359aeaaedea1d4404a6”
2019-03-07 15:48:46: “DecryptionWorker: starting decryption…”
2019-03-07 15:48:46: “Reducer action”, “DECRYPTION_WORKER_SET”
2019-03-07 15:48:46: “DecryptionWorker: completed decryption.”
2019-03-07 15:48:46: “Reducer action”, “DECRYPTION_WORKER_SET”
2019-03-07 15:48:55: “SearchEngine: Updating FTS table…”
2019-03-07 15:48:55: “SearchEngine: Updated FTS table in 2ms”
2019-03-07 15:48:55: “Preparing scheduled sync”
2019-03-07 15:48:55: “Starting scheduled sync”
2019-03-07 15:48:55: “Reducer action”, “SYNC_STARTED”
2019-03-07 15:48:55: “Sync: starting: Starting synchronisation to target 5… [1551970135277]”
2019-03-07 15:48:55: “Reducer action”, “SYNC_REPORT_UPDATE”
2019-03-07 15:48:55: “mkdir .sync”
2019-03-07 15:49:15: “ResourceService::indexNoteResources: Start”
2019-03-07 15:49:15: “ResourceService::indexNoteResources: Completed”
2019-03-07 15:49:15: “ResourceService::deleteOrphanResources:”, “[]”
2019-03-07 15:53:45: “Running background sync on timer…”
2019-03-07 15:53:45: “Scheduling sync operation…”
2019-03-07 15:53:45: “Preparing scheduled sync”
2019-03-07 15:53:45: “Starting scheduled sync”
2019-03-07 15:53:45: “La synchronisation est déjà en cours. État : in_progress”
2019-03-07 15:53:45: “Setting up recurrent sync with interval 300”
2019-03-07 15:58:45: “Running background sync on timer…”
2019-03-07 15:58:45: “Scheduling sync operation…”
2019-03-07 15:58:45: “Preparing scheduled sync”
2019-03-07 15:58:45: “Starting scheduled sync”
2019-03-07 15:58:45: “La synchronisation est déjà en cours. État : in_progress”
2019-03-07 15:58:45: “Setting up recurrent sync with interval 300”
2019-03-07 16:01:50: “FetchError: request to http://xxxx.synology.me/nextcloud/remote.php/webdav/Joplin/.sync/ failed, reason: socket hang up
Code: ECONNRESET
FetchError: request to http://xxxx.synology.me/nextcloud/remote.php/webdav/Joplin/.sync/ failed, reason: socket hang up
at ClientRequest. (/tmp/.mount_JoplinV136s1/resources/app/node_modules/node-fetch/index.js:133:11)
at ClientRequest.emit (events.js:182:13)
at Socket.socketOnEnd (_http_client.js:425:9)
at Socket.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1092:12)
at process._tickCallback (internal/process/next_tick.js:63:19)”
2019-03-07 16:01:50: “Sync: finished: Synchronisation finished [1551970135277]”
2019-03-07 16:01:50: “Reducer action”, “SYNC_REPORT_UPDATE”
2019-03-07 16:01:50: "Operations completed: "
2019-03-07 16:01:50: “Total folders: 1”
2019-03-07 16:01:50: “Total notes: 4”
2019-03-07 16:01:50: “Total resources: 3”
2019-03-07 16:01:50: “Reducer action”, “SYNC_COMPLETED”
2019-03-07 16:01:50: “Setting up recurrent sync with interval 300”
2019-03-07 16:01:50: “Updating all notifications…”
2019-03-07 16:01:50: “Garbage collecting alarms…”
2019-03-07 16:01:51: “DecryptionWorker: starting decryption…”
2019-03-07 16:01:51: “Reducer action”, “DECRYPTION_WORKER_SET”
2019-03-07 16:01:51: “DecryptionWorker: completed decryption.”
2019-03-07 16:01:51: “Reducer action”, “DECRYPTION_WORKER_SET”
2019-03-07 16:06:50: “Running background sync on timer…”
2019-03-07 16:06:50: “Scheduling sync operation…”
2019-03-07 16:06:50: “Preparing scheduled sync”
2019-03-07 16:06:50: “Starting scheduled sync”
2019-03-07 16:06:50: “Reducer action”, “SYNC_STARTED”
2019-03-07 16:06:50: “Sync: starting: Starting synchronisation to target 5… [1551971210734]”
2019-03-07 16:06:50: “Reducer action”, “SYNC_REPORT_UPDATE”
2019-03-07 16:06:50: “mkdir .sync”

Any idea what could be the reason ?
Thanks.

#2

I don’t think this is an issue with Joplin - as mentioned in this answer, all that can be done is report the error and maybe retry later (which the app already does, but I guess it keeps failing): https://stackoverflow.com/questions/16995184/nodejs-what-does-socket-hang-up-actually-mean

Maybe increase the timeout on your server?

#3

Yes, it is strange… It is a timeout for sure, but I don’t understand why. Checking sync takes 2 seconds on desktop and smartphone, but ends with a timeout on the laptop.
May be some firewall issue ?
But on the client side, it is only about HTTP and port 80, am I right ? So I should not have anything special to set there…

#4

I seriously hope you meant https and port 443. While your notes would still be encrypted, if you were to use Joplin encryption, but your synology password would not. Just an observations. Has most likely nothing to do with your problem.

#5

Some progress : It is related to my VPN up or not… Thus most probably to the DDNS service provided by Synology (xxxx.synology.me).
On my desktop, VPN is up and thus I could sync (default). Found that if I do not activate my VPN, then I have the same error as for the laptop when trying to sync.
Investigating on that side now ! :slight_smile:

#6

Got it to work ! :smiley:
I used wireshark to make some traces, and realized that when VPN is not active, the Synology NAS was replying to desktop using the local address (192.168.1.y), while desktop was waiting for an answer coming from the external (box address actually). So I don’t really now why and how to fix this properly, but I found a way to make it works:
On the Synology NAS side, I added its own local address (192.168.1.z) is a “trusted domain” in the config.php file (from Nextcloud). Then on Joplin configuration side, I changed URL to 192.168.1.z in place of xxx.synology.me.
Doing that, the sync now works without the VPN activated on the desktop. This is not the ideal fix I guess, but this all I found by myself ! :wink:

May be this will help someone else, or may be some will provide a better way to fix this.

#7

Well for troubleshooting, it is easier to use http (wireshark traces)… I will switch back to https when issue is solved.
EDIT : but with the “workaround” I used (see above), the Let’s Encrypt certificate does not work anymore (local address)… I have to find a better to fix my problem… :frowning: