docker icon indicating copy to clipboard operation
docker copied to clipboard

504 Gateway Time-out on pocket import

Open McMac opened this issue 7 years ago • 20 comments

Hello,

I get a 504 Gateway Time-out when trying to import from pocket:

  1. launched wallabag docker: docker run -p 80:80 wallabag/wallabag
  2. logged in using wallabag:wallabag
  3. Config -> Consumer key for Pocket to import contents
  4. Import -> Pocket: Import Contents
  5. Dies during http://localhost/import/pocket/callback with error 504
  6. After that the container does not respond anymore
  7. Restart container: 380 entries added
::ffff:172.17.0.1 - - [19/Mar/2017:15:18:58 +0000] "POST /import/pocket/auth HTTP/1.1" 301 289 "http://localhost/import/pocket" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0"
2017/03/19 15:20:01 [error] 322#322: *58 upstream timed out (110: Operation timed out) while reading response header from upstream, client: ::ffff:172.17.0.1, server: _, request: "GET /import/pocket/callback HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "localhost"
::ffff:172.17.0.1 - - [19/Mar/2017:15:20:01 +0000] "GET /import/pocket/callback HTTP/1.1" 504 176 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Firefox/52.0"

I have used pocket more as a bookmarks + content archive than actual read it (very much) later so over several years I added > 13k entries in pocket. I would like to extract them into wallabag and then from there sift through what's still valid or needs proper tagging.

Also tried but wallabag won't properly launch (obviously)

docker run -p 6379:6379 --name redis redis:alpine
docker run -p 80:80 --link redis:redis wallabag/wallabag import pocket
  • Recreated the wallabag docker image without "import pocket"
  • Enabled Redis async import within Internal Settings (pocket import configure in 3 different submenus?)
  • again 504 error
  • actually got no clue if and where I should provide the "import pocket" command.

The import never works/worked properly always dying of timeouts. The integration with redis also doesn't appear very stable enough.

Has anybody gotten the pocket import to work with more then 5 entries? The instructions on how to import using Redis seem to be broken as instructions state:

Import worker

To run the async redis import worker use the following command: $ docker run --name wallabag --link wallabag-db:wallabag-db --link redis:redis -e <... your config variables here ...> wallabag/wallabag import

As clearly at this point the container is already running or using that command only, the container won't launch. During first time setup nothing is set up for pocket import obviously.

Can anybody please enlighten me where I am going wrong?

McMac avatar Mar 19 '17 15:03 McMac

i never used the importer. mmhhh.. maybe we should set up the timout higher for nginx to connect to php-fpm.

xsteadfastx avatar Mar 22 '17 07:03 xsteadfastx

I experienced the same error but all in all wallabag imported all articles in the end.

Suncatcher avatar Mar 23 '17 12:03 Suncatcher

Seems like fastcgi_read_timeout should be increased.

DmitrySandalov avatar Jun 05 '17 23:06 DmitrySandalov

Increasing fastcgi timout creates this new error.

500: Internal Server Error Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10236384 bytes)

bermudi avatar Jul 01 '17 07:07 bermudi

Increase memory limit then.

j0k3r avatar Jul 01 '17 08:07 j0k3r

gives same error even with memory limit -1

bermudi avatar Jul 01 '17 15:07 bermudi

doesnt this look like a docker host problem?

xsteadfastx avatar Jul 03 '17 09:07 xsteadfastx

The point being, this feature was probably tested with a few test records which for neither you would run into a timeout (lengthy response) or memory (too much data during response) issue.

The "easiest" fix would be to support a recovery (skip what was already imported - URL match? deduplication should be built-in IMHO - or simply define the db to make URL unique, then handle the respective db response in php) plus adding some sort of batching if the response is expected to be voluminous (not sure if pocket only streams the results or provides means to access the count). (get count, wrap current code into a for loop).

Currently, I do data migrations for a living but unfortunately not proficient enough in php to be of much help. :-S Maybe I need to jump into the deep end...

McMac avatar Jul 05 '17 08:07 McMac

i have the same issue right now i have around 8000 entries in my Pocket. thing is pocket does offer an export into HTML but this as is can not be feeded into Wallabag, i guess if someone would know how to parse it and convert to a format like google s html exported bookmarks ( wallabag accepts those html formatting) it could be done in mass amount offline way ....

viktormadarasz avatar Aug 21 '17 19:08 viktormadarasz

Did this issue ever get fixed? still seeing it on 2.2.3?

JENkt4k avatar Jan 02 '20 06:01 JENkt4k

I have a timeout on import too, not sure what to change

maltokyo avatar Apr 02 '20 18:04 maltokyo

I'm still having this issue too.

gmolveau avatar Apr 18 '20 06:04 gmolveau

Same issue here. Importing 2200 Pocket articles results 504. I tried doing this over hours of refreshing and reimporting - it kept increasing the article count so I assumed it was picking up where it left off. Nope, TONS of duplicates.

timespaced avatar May 16 '20 04:05 timespaced

Same issue here. Importing 2200 Pocket articles results 504. I tried doing this over hours of refreshing and reimporting - it kept increasing the article count so I assumed it was picking up where it left off. Nope, TONS of duplicates.

same problem here. prefer solution with loop as I installed walalbag on shared hosting without possibility to increase memory or timeout

herrxyz avatar Jul 01 '20 07:07 herrxyz

@herrxyz did you find a solution with your "solution with loop" ? Thank's !

gmolveau avatar Jul 03 '20 13:07 gmolveau

sorry, haven't tried further. As my php-skills are really low I'm just hoping for a wallabag update (instead of trying it itself)

herrxyz avatar Jul 06 '20 06:07 herrxyz

Anyone has a workaround for the import? Or am I having a different problem?

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 131072 bytes) in /var/www/wallabag/vendor/j0k3r/php-readability/src/Readability.php on line 1434 [Symfony\Component\Debug\Exception\OutOfMemoryException]
Error: Allowed memory size of 134217728 bytes exhausted (tried to allocate
131072 bytes) Exception trace: () at /var/www/wallabag/vendor/j0k3r/php-readability/src/Readability.php:1434 wallabag:import:redis-worker [--maxIterations [MAXITERATIONS]] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <serviceName>

ghost avatar Aug 14 '20 10:08 ghost

The best way to handle timeout error is to use import queue (using RabbitMQ or Redis). https://github.com/wallabag/docker#import-worker

j0k3r avatar Aug 21 '20 10:08 j0k3r

Hello everyone, I created a python script to export your pocket items to wallabag : https://github.com/gmolveau/pocket_to_wallabag

Feel free to use it :) (also did a feedly script : https://github.com/gmolveau/feedly_to_wallabag)

gmolveau avatar Aug 22 '20 14:08 gmolveau

Hello everyone, I created a python script to export your pocket items to wallabag : https://github.com/gmolveau/pocket_to_wallabag

Feel free to use it :) (also did a feedly script : https://github.com/gmolveau/feedly_to_wallabag)

Works flawlessly, thanks for sharing!

dotWee avatar Nov 24 '20 01:11 dotWee