profile
viewpoint

Ask questions0.12.5 throws error while loading images over https but works with 0.13.0 Alpha

I am using wkhtmltopdf to print Interactive Google Map (created using Google Map JS API) to PDF. Also custom tiles are shown over google map using another locally built API. When such map is printed to PDF using wkhtmltopdf 0.12.5; we get few errors mentioned below but the pdf is still generated with partially loaded tiles over map. I have pasted some sample errors below.

But if I access the images using http (instead of https) with 0.12.5 OR using https with 0.13.0 (alpha) it works without any issue. Also when the map is loaded in any browser, there is no error as well. So what is the problem in using https with 0.12.5?

Error: Failed to load https://someURL?request=GetMap&format=image/png&bgcolor=0xFFFFFF&transparent=true&SRS=EPSG:3857&width=256&height=256&reaspect=false&layers=parcel_layer&styles=parcel_gray_style&bbox=-11721771.161588348,4869344.44987887,-11721159.665362068,4869955.9461051505, with network status code 2 and http status code 0 - Connection closed Error: Failed to load https://someURL?request=GetMap&format=image/png&bgcolor=0xFFFFFF&transparent=true&SRS=EPSG:3857&width=256&height=256&reaspect=false&layers=flood&styles=flood_new_style,flood_label_style&bbox=-11721771.161588348,4868732.953652587,-11721159.665362068,4869344.44987887, with network status code 99 and http status code 0 - Unknown error

wkhtmltopdf/wkhtmltopdf

Answer questions Jehoel

I'm experiencing this with 0.12.5 x64 on Windows. I'm running wkhtmltopdf.exe inside an Azure App Service (aka "Azure Website", not a Cloud Service/Worker Role).

Command-line:

--page-size Letter --margin-left 3mm --margin-top 20mm --margin-right 3mm --margin-bottom 20mm --lowquality - -

Exit code: 1

Here's the stderr output:

Loading pages (1/6)
[>                                                           ] 0%
[======>                                                     ] 10%
[========>                                                   ] 14%
Warning: SSL error ignored                                        
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
Warning: SSL error ignored
[========>                                                   ] 14%
[===============================>                            ] 53%
[========================================>                   ] 67%
Error: Failed to load https://mystorageaccount.blob.core.windows.net/catpictures/kitten1.jpg, with network status code 2 and http status code 0 - Connection closed
Error: Failed to load https://mystorageaccount.blob.core.windows.net/catpictures/nyancat.jpeg, with network status code 99 and http status code 0 - Unable to decrypt data: error:07069041:memory buffer routines:BUF_MEM_grow_clean:malloc failure
[=========================================>                  ] 69%
[===========================================>                ] 72%
[============================================>               ] 74%
[==============================================>             ] 78%
[================================================>           ] 81%
[=================================================>          ] 83%
[====================================================>       ] 87%
[=====================================================>      ] 89%
[=====================================================>      ] 89%
[============================================================] 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 5
[========================>                                   ] Page 2 of 5
[====================================>                       ] Page 3 of 5
[================================================>           ] Page 4 of 5
Corrupt JPEG data: premature end of data segment
[============================================================] Page 5 of 5
Done                                                                      
Exit with code 1 due to network error: UnknownNetworkError


Looks like it dies due to malloc() failure in openssl - as though it's running out of memory.

The memory-usage metrics that Azure logged at the time of this failure do not indicate there was any problem with memory usage or unusual memory usage (though it's possible the memory usage spiked between samples - I don't know how Azure measures memory usage exactly).

useful!
source:https://uonfu.com/
answerer
Dai Jehoel Redmond, WA Former Microsoft software engineer; former dotcom/software startup employee; former SourceForge user; former SVN user; former human;
Github User Rank List