![]() |
#1 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
|
Calibre gets stuck syncing
Hi
I am having a major issue with Calibre and CC and I am not sure where the probvlem comes from exactly. If my wireless device looses connection in the middle of a sync, Calibre gets stuck syncing mode (I can see in the jobs). And it never times out or disconnecs or cancels the job even though no device is connected since the device has lot its connection. The main problem with this issue is that I cant get my CC to reconnect again becauuse Calibre thinks a device has already been connected for a while. I am using the 2.58 version on Linux 64 Debian testung. thanks Last edited by loviedovie; 06-19-2016 at 11:51 AM. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Strange. The calibre wireless device driver does time out if the connection really disappears. It sends a "HELLO" every 10 seconds that something must receive or the connection shuts down. My guess is that the connection is still open -- that something between CC and calibre is keeping the network connection alive. It also could be that the network timeout defaults on your system are *very long*. How long have you waited for calibre to detect that CC has disappeared?
In any event, you can force calibre to disconnect. Click on the Device button and choose "Eject this device". You can also reboot your device which should remove any trace of the connection, should the version of Android on your device be doing something strange with networking. If this doesn't cause calibre to disconnect then something is very broken on your calibre machine. A calibre debug log might give some clues. There is also the question about why CC is losing the connection. That implies that the WiFi you are using isn't reliable. |
![]() |
![]() |
![]() |
#3 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
|
@chaley
The disconnect trick does not work because Calibre complains that there are on going jobs so it refuses to disconnect. The only solution I found is to restart Calibre. As far as the timing out goes, I do not think that Calibre figured out that the device disconnected after sometime. Maybe I did not wait long enough. I am sure that I waited at least 10 mins when it happened. This happened to at least 6 times inm last 2 days when I was trying to sync large number of books ( which were alredy in the folder). I do not think thatr the issue is CC, it must be Calibre getting fooled here. Because if the wireless connection is not available on the device there is not much CC can do which is what generally happened to me. Basically the device looses the connection and Calibre never ejects the device after loosing it. It sounds like Calibre does not think that the device has been disconnected even though the device lost its wifi. |
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
From what you said in your thread in the CC forum I suspect that the job is calibre doing the analysis of the book files CC discovered in its library directory.
|
![]() |
![]() |
![]() |
#5 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
|
After doing couple more tests, I believe that Calibre never terminates the device if the device connection drops abrubtly which results in refused connections from any device.
I think that Calibre should terminate jobs and connections if it cant engage in meaningful andsuccessful handshakes with the device after certain time periods, say half an hour to one hour. If within this time frame none of the connected devices responds back properly, Calibre should just terminate the device connection (and jobs related) because it is hard to restart Calibre on the go on a cell phone or an eink device. Or maybe CC can have an option to for a reconnect regardless of the connected device. Basically my connection was disconnected while syching when I was out. 6 hours later I wanted to connect back with CC and guess what Calibre still was thinking that there was already a device connected and was refusing my wireless device connection attempt. So I had to restart Calibre. Thankfully I was close to my desktop this time. Last edited by loviedovie; 06-26-2016 at 12:14 AM. |
![]() |
![]() |
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
I have run the following experiments to check if CC and calibre disconnect properly.
In order to avoid any "normal" shutdown processing, in the second through fourth experiments I "disconnected" by removing my WiFi hub from the network. This process ensures that neither CC nor calibre are aware that the network has been cut until something times out. I include the relevant portions of the calibre debug log for each experiment. Experiment 1: the baseline -- connect and disconnect normally. As expected, it works; calibre disconnects normally. Spoiler:
Experiment 2: disconnect during the startup handshake. Calibre disconnects normally. In some cases CC can wait for some hours (the general network keepalive timeout) showing a dialog box waiting for you to tap "Cancel", but this is not the behavior you are describing. Spoiler:
Experiment 3: disconnect after CC and calibre finish all startup processing. CC is waiting for commands from calibre. Calibre notices the disconnect after some 20 seconds and disconnects. CC may or may not notice at approximately the same time. If CC does notice then it shows a dialog. If it does not notice then it waits until you manually disconnect (CC's menu). As mentioned above CC should time out in a few hours but I didn't wait that long. Spoiler:
Experiment 4: disconnect while calibre and CC are negotiating about syncing books. Calibre noticed and disconnected. Usually the disconnect happened in seconds, but during two runs of the experiment it took all of the 300 seconds (5 minutes) allowed by the calibre wireless driver. However, there is a problem on the CC side. CC does not notice for hours (the network "keepalive timeout") and there is no way to cancel the process other than to force-stop CC. A similar case was reported in the past but I didn't find the cause. Now I have it and the fix will be in the next release. In any event, this isn't the problem you are reporting because it is obvious that CC thinks it is still connected and waiting for books to be transferred. Spoiler:
Experiment 5: Force-close CC while leaving the WiFi connected. This checks that Android correctly closes the network sockets. Calibre noticed the disconnect very quickly. Spoiler:
As you can see, none of these experiments repeat the behavior you report. I don't deny that you are seeing the behavior you describe but I can't fix anything until I can reliably repeat it. You might try producing a calibre debug log, which might give some clue(s) about what it happening. |
![]() |
![]() |
![]() |
#7 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
|
Chaley
Thanks for extensive debugging. I wonder if I am having a platform related improper disconnects here. I am using Calibre on Debian 64bit Testing. |
![]() |
![]() |
![]() |
#8 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
Run calibre in debug mode until you capture one of these events. As I said earlier, we might be able to get some clues from a log. |
|
![]() |
![]() |
![]() |
#9 |
Addict
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 295
Karma: 2139988
Join Date: Nov 2014
Device: bookeen
|
@chaley
Can you try this which involves ssh-ssh terminal(connectbot)-ssh server to be able to forward ports. Basically I forward 9798 to localhost on my tablet so that I can connect to Calibre as a wireless device from anywwhere in the world securely. Lets say Calibre runs on 10.6.0.150 I forward my port as -L9798:10.6.0.150:9798 and I pit localhost:9798 in CC. Once the connection is established on ssh I then connect as wireless device. This works great for me. But I am wondering if Calibre device being stuck has anything to do with this set up, for instance when ssh co0nnection drops in the middle due to wireless issues. thanks |
![]() |
![]() |
![]() |
#10 | |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,339
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
Quote:
It is probable that the tunnel isn't being torn down when CC is disconnected. Calibre is sending packets to CC when CC isn't there. Some SW managing the tunnel should notice that the packets calibre is sending are going down a rat hole and shut down the tunnel. I don't know how you can fix that in your setup. Manually shutting the tunnel down on the device might do the job. |
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Synching between Calibre 1.19 and Kindle Touch | booke02 | Amazon Kindle | 0 | 01-12-2014 04:48 PM |
Synching bookmarks between Calibre and Kindle Paperwhite | lucitedragon | Library Management | 1 | 05-28-2013 11:40 PM |
Calibre, iPad & itunes not synching correctly | Oscar Berke | Devices | 1 | 05-29-2011 05:56 PM |
Stuck with Calibre 0.7.34 from now on? | Lupa | Calibre | 18 | 01-08-2011 08:42 AM |
Synching wordplayer with Calibre using content server | djstorman | Calibre | 0 | 11-11-2009 07:18 PM |