Closed casaucao closed 6 years ago
What is the size of the file?
Exported xml file size is 280kb.
Once exported, I choose Wordpress importer, and I select "download and import file attachments", then I got the 502 error (upstream prematurely closed connection while reading response header from upstream)
That's weird... this is the log of the proxy? of the wordpress container? I thing this probably not related with the repo itself.. but the wordpress data...
Do you have the same url name for the domain you are having?
Actually weird. The log is from nginx container, not from wordpress container. I don't really know how to see error logs from wordpress container. This is what I do:
docker logs --details -f [wordpress_container]
and I get the following info while I'm trying to import the xml file:
172.18.0.4 - - [07/Jul/2018:11:33:20 +0000] "GET /wp-admin/import.php?import=wordpress HTTP/1.1" 200 6617 "https://example.com/wp-admin/import.php" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36"
172.18.0.4 - - [07/Jul/2018:11:33:31 +0000] "POST /wp-admin/admin.php?import=wordpress&step=1&_wpnonce=7dad11711c HTTP/1.1" 200 6904 "https://example.com/wp-admin/import.php?import=wordpress" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36"
172.18.0.4 - - [07/Jul/2018:11:34:00 +0000] "GET /wp-admin/load-styles.php?c=0&dir=ltr&load%5B%5D=dashicons,buttons,forms,l10n,login&ver=4.9.7 HTTP/1.1" 200 37059 "https://example.com/wp-login.php" "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; Googlebot/2.1; +http://www.google.com/bot.html) Safari/537.36"
172.18.0.4 - - [07/Jul/2018:11:34:01 +0000] "GET /favicon.ico HTTP/1.1" 404 465 "-" "Googlebot-Image/1.0"
Apparently there are no errors but I think this is the access log instead error log.
Domains are differents. Old is example.wordpress.com and new is example.com.
AFAIK wordpress+apache container is going to retreive data (posts, comments, images,... ) from example.wordpress.com through the nginx proxy container. At some stage, wordpress or apache container fails and nginx proxy shows a 502 error message logging "upstream prematurely closed connection while reading response header from upstream" in the nginx container. At least this is what I think, but I don't know how to identify the issue in order to solve it.
After the import the container remains up?
Try to add the wp-cli to your composer and update the url in database or pull up a phpmyadmin in your docker and check the database what might be wrong... I don´t think there is something in container itself... might be wordpress settings... not sure at all
Yes, after the import the container remains up!
Database is ok. No issues.
I'm added wp-cli as follow:
sudo docker run -it --user root --rm --volumes-from wordpress --network container:[container_id] wordpress:cli /bin/sh
Once I got a shell, I type:
wp import exported_file.xml --authors=create --debug
And the importer script FAILS:
Processing post #145 ("IMG_8180-1") (post_type: attachment)
-- 57 of 133 (in file example.wordpress.2018-07-05.xml)
-- Sun, 08 Jul 2018 08:19:59 +0000
Killed
If I remove that media entry from the exported file all works fine. I open that image in a browser and that image is 5184x3456px. Maybe an OOM error?
I fear this is not an OOM error.
I have deleted all database and wordpress files and containers, then I reinstalled wordpress from scratch. When I have launched wp import I have discovered that there are multiples media entries that "kill" the process.
All images are about 4000x2000 5000x3000px ~~.
If I launch again the wp-cli import command, all works fine (the new process imports the failing image and continue importing the rest of the images until the next "killed")
I have to repeat
wp import exported_file.xml --authors=create --debug
at least 15 times in order to get all the images.
SOLVED!
It's was a memory issue. The containers were running on a 512MB RAM instance (too few mem) Adding a Swap page solved the problem for me.
This link just made my day: https://stackoverflow.com/a/13999800
Thank you very much for your support. You did a very great job!
Thanks @casaucao!!
It seems it did a better job! by solving the issue. Thanks for sharing and we will keep that tip for the future.
Cheers!
With a fresh install I have imported a wordpress.com blog through Wordpress importer and the generated xml file.
After few seconds (maybe few minutes) I got an error:
502 Bad Gateway
Looking in nginx logs files I can see:
Could anybody help me?