New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
exceeded the timeout of 60 seconds ? #9
Comments
those tmp files are created... which are the incomplete html and pdf (all the elements just with some css missing) and remain in the directory |
Is this with all views? Can you try with a simple view with just plain text? |
Thanks for your response. I haven't tried with any other view (will do), and the one I'm trying is really simple, just a list of items so just a table with text (it had images but I removed all for the moment). The view loads well as if I dd($pdf) the object is created and the view displayed correctly(the ["html"] => string()). I changed the timeout in the snappy AbstractGenerator.php so it may have more time to finish, I try with 360 and got the same result... I just set it to 0 (so timeout is disabled) and will let it run for a while to see what happens. Edit: With no timeout is the browser the one that throws connection has timed out =( Edit 2: without images it throws (in just 1 sec): RuntimeException The exit status code '1' says something went wrong: stderr: "Loading pages (1/6) [> ] 0% [======> ] 10% [=======> ] 12% [============================================================] 100% Counting pages (2/6) [============================================================] Object 1 of 1 Resolving links (4/6) [============================================================] Object 1 of 1 Loading headers and footers (5/6) Printing pages (6/6) [> ] Preparing [============================================================] Page 1 of 1 Done Exit with code 1 due to http error: 1302 " stdout: "" command:/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 '/tmp/knp_snappy539b125e497e95.90154509.html' '/tmp/knp_snappy539b125e4990c3.19775282.pdf'. this is a snappy error so will check it and see what I find. |
I've made various test, turns out the problem is (as expected) in the snappy and/or wkhtmltopdf... so I don't know if a should keep posting here. Anyway here is what I found: this will work: this will work pretty well but maybe not perfectly throws (still generating the file): RuntimeException The exit status code '1' says something went wrong: stderr: "Loading pages (1/6) [> ] 0% [======> ] 10% QSslSocket: cannot resolve SSLv2_client_method QSslSocket: cannot resolve SSLv2_server_method [========> ] 14% [=========> ] 16% [===========> ] 19% [============> ] 21% [==============> ] 24% [===================> ] 33% [=========================> ] 43% [================================> ] 54% [========================================> ] 68% [============================================================] 100% [======> ] 10% [============================================================] 100% [======> ] 10% [============================================================] 100% [======> ] 10% [======> ] 10% [==================> ] 30% [==============================> ] 50% [==========================================> ] 70% [============================================================] 100% Counting pages (2/6) [============================================================] Object 1 of 1 Resolving links (4/6) [============================================================] Object 1 of 1 Loading headers and footers (5/6) Printing pages (6/6) [> ] Preparing [==============================> ] Page 1 of 2 [============================================================] Page 2 of 2 Done Exit with code 1 due to http error: 1005 " stdout: "" command: /vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 'http://www.w3schools.com' '/tmp/testPdf.pdf'. and locally as in: throws (still generating the file): ProcessTimedOutException The process "/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf-amd64 'http://localhost:8000/subastas/9' '/tmp/testPdf.pdf'" exceeded the timeout of 120 seconds. I'll keep trying as I need this, but as the problem is not with your wrapper I won't post anymore unless you have no problem with that. If I found a solution I'll definitely post it =) |
Ok, the solution is really simple actually, the problem is that it wont work on dev(local) environment because for some reason the wkhtmltopdf doesn't like localhost:8000... whatever. (I guess it has to be with how wk handless the address... maybe?) and for example for the css the href needs to be complete (with http://): this works -> http://netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css same with images or any other reference you may have. That was all, sorry for any inconvenience =) |
I got the same error.
whenever I try to call a css file in header, I will get the error. I will not get the error if I remove it or replace it with full url path So the problem is I can not use my own css and put it into my template. I ran on local by using built-in php server on ubuntu 14.04 (64 bit) anyway both file was create in tmp anyone got any solution for this? Thank you |
Okay now facing the same issue after updating something (not sure what). The commands executes fine and the file is generated, but somehow not received correctly. Related: KnpLabs/snappy#58 |
I also encountered this issue, but in my case the timeout was due to a HostNotFoundError. Just remember if you add input rules to iptables and its policy is "drop", and you limit to a select few IP addresses, make sure you allow localhost access to itself. This is what caused the issue for me - also the process doesn't terminate, but that's a whole other issue. Edit: I forgot to mention that this is marginally related to the inability to add relative urls. |
I just stumbled upon the same problem when adding an image from my own host which indeed is Any solution - workaround for this? Is it a |
Try localhost with default HTTP port (80). Be sure that this image is available from machine where wkhtmltopdf tool is installed. Try download this image using wget. |
Thanks @colejarczyk . I couldn't switch the port to 80 due to permissions on my machine. But I switched to 8080. A But I still have the same problem. The strange thing is the |
Try to execute render command in console. To get command you can "echo" it by call "getCommand" method of AbstractGenerator class. You should get more verbose output about problems. |
Good tip, thanks @colejarczyk . 👍 I will be able to check the project again next year. I will report then! |
Still checking the port problem. Testing the command next @colejarczyk . Feel free to follow my steps on my gist: |
I tried to get the command: $html = $this->renderView('AppBundle:Bundle:list.html.twig', $viewParameters);
$snappy = $this->get('knp_snappy.pdf');
echo $snappy->getInternalGenerator()->getCommand($html, 'test.pdf', array(
'orientation' => 'Landscape',
'images' => true,
'enable-javascript' => true
)); The result is a simple
I think the command is incomplete since it uses a symfony2 twig rendered template as |
I found the root of my problems caused by the PHP built-in server because it is single-threaded, @colejarczyk . Fur further details: Thanks anyway! |
I would never thought that you'll trying to test wkhtmltopdf in PHP built-in server :) |
Believe me @colejarczyk , it was not my choice! ;) And yes, Vagrant is next! :) |
I meet the same timeout problem in our production server. It is weird that most of time, everything works fine and we can generate the PDF. I am using {{ HTML::style('my.css') }} or {{ HTML::script('my.js') }} for all css and js file. Does anyone know how to fix this problem? |
I have the same problem and was only realized it was due to the unstable version of wkhtmltopdf (0.11rc1). Wkhtmltopdf was hang and not returned, eventually causing the timeout. Switching to 0.12.1 fixed the problem. |
I have the same problem but in my case temp html files aren't being created and It works fine for few views but for one view its giving me problem |
I also run the PHP built in server and get a timeout-error if i try to access external css/js files. If i inline everything then it works like a charm. |
Did you check my comment @fatihict ? |
@webdevilopers Yes, i saw you comment. Thanks for your help. |
We also have the timeout, but it is expected because the html result is huge so it does really take Snappy over 60 seconds to generate the PDF. All issues I've found are related to Is there another option next to calling Edit: actually found the answer for that, the $this->get('knp_snappy.pdf')->getInternalGenerator()->setTimeout(300); |
Thanks @rvanlaak. |
@rvanlaak if i set this in the AppServiceProvider will all calls to Snappy pdf now have this timeout? |
@bgarrison25 you've got a link to the class you mean? We don't use this laravel wrapper bridge but use the KnpSnappyBundle, but I can't find the file in that bundle or even in this bundle or |
@barryvdh |
On our dedicated the timeout issue was solved by disabling ipv6. |
I had similar issue. |
Specifying a timeout value in |
It worked for me ! Anyone can explain this? |
The wkhtmltopdf does not use the actual browser domain to resolve the files. With I had the same issue before. |
If someone else has this problem, well I found this kind-of solution .. i also use ngrok to put my site on the internet Delete every redirects you have in hosts file (in linux its etc/hosts) except for example mysite.test 127.0.0.1 also edit httpd-vhosts.conf file and delete other vhosts you have.. then run command from terminal It should work. I tried to use php -s command but it didn't work. I use lampp (xampp for linux) |
Thanks!!!!, This has worked for me. |
I have this issue too. Mine is because of image in pdf which was taken form asset. I remove the image it works. |
I had the same issue, it was because of internet (slow or not working), I then switched to different network and works fine. Just in case anyone have the same problem :-) |
Hi, I'm having a hard time making this work and don't know what to check.
Symfony \ Component \ Process \ Exception \ ProcessTimedOutException The process "/vendor/h4cc/wkhtmltopdf-amd64/bin/wkhtmltopdf --lowquality '/tmp/knp_snappy539a1b5171a923.27143750.html' '/tmp/knp_snappy539a1b5171b010.24930374.pdf'" exceeded the timeout of 60 seconds.
Thats been thrown.
Any ideas?
I already check that the bin is working
Thanks for any help =)
The text was updated successfully, but these errors were encountered: