janis91 / ocr

Nextcloud OCR (optical character recoginition) processing for images with tesseract-js
GNU Affero General Public License v3.0
107 stars 17 forks source link

Download does not work due to Curl timeout #249

Closed e-alfred closed 4 years ago

e-alfred commented 4 years ago

I am trying to update to OCR 5.0.0 but the upgrade process stops due to a Curl timeout after 30 seconds:

sudo -u www-data php occ upgrade
Nextcloud or one of the apps require upgrade - only a limited number of commands are available
You may use your browser or the occ upgrade command to do the upgrade
Set log level to debug
Updating database schema
Updated database
Updating <ocr> ...
Drop old database table

 Done
 1/1 [============================] 100%
Fetch tessdata for ocr.
 Checked if tessdata already exists.
 1/5 [=====>----------------------]  20%Repair warning: Installation cannot not be completed, because an Exception was thrown.
GuzzleHttp\Exception\ConnectException: cURL error 28: Operation timed out after 30000 milliseconds with 5309004 out of 184630366 bytes received (see http://curl.haxx.se/libcurl/c/libcurl-errors.html)
Update failed
Maintenance mode is kept active
Reset log level
janis91 commented 4 years ago

Oh. I did not think of slow internet connections... I will try to fix this.

e-alfred commented 4 years ago

Well, 1Gbit/s shouldn't be that slow, but it still seems to timeout. Even after multiple retries.

janis91 commented 4 years ago

Is it you or your server (where NC runs on), that got 1Gbit/s? Because it is related to your server: 30000 milliseconds with 5309004 out of 184630366 bytes received It downloads about 186 MB from github tessdata release. That should be pretty fast with mentioned performance. I wonder why this timeouts then.. Nevertheless I will set a timeout of 10 minutes as default, sucht that folks with poor connections also have the chance to retrieve the data.

feutl commented 4 years ago

having the same issue. thanks

janis91 commented 4 years ago

Yeah I have the same issue as well. Wtf. I don‘t get why this is happening..

janis91 commented 4 years ago

Ok v5.0.3 seems to work now. The release of 5.0.2 didn't work somehow. I will have a look at it, when it comes to more such errors. I will close this issue now. 5.0.3 worked for me.

bpcurse commented 4 years ago

As the update takes quite long (although our server has a 1GBit/s connection), nextcloud shows the maintenance mode page and users might be irritated and think of an internal error or crash that won't recover automatically.

Is there a way for app developers to show some kind of "this update might take several minutes, please be patient" splash screen on update start?

janis91 commented 4 years ago

Is there a way for app developers to show some kind of "this update might take several minutes, please be patient" splash screen on update start?

Unfortunately, there isn't an option like this. But I personally think that there might be an issue with the http client in nextcloud somehow, because I experienced the same issue and I am also sure, that the file of ~180MB should be loaded much faster than in 30s. I still changed the default timeout for really slow connections, but if I download that file via curl from the server directly it takes about 12 seconds. 15 seconds at worst, but never longer than 20 seconds with my connection. With nextcloud it takes obviously much longer.

There are also some issues reported in the repository: https://github.com/nextcloud/server/issues/17776 https://github.com/nextcloud/server/issues/17808 https://github.com/nextcloud/server/issues/17792