Pdf generation locks up erpnext


Every time I try to print a pdf in erpnext using the “pdf” button, it locks up erpnext and the website stops responding. Eventually after about 10 minutes it starts to respond again. Alternately one can restart the virtual machine to bring the website back up.

The virtual machine itself still responds over ssh without issue, and I don’t know where to look in the logs to provide a more detailed error to this post. I have to print via other methods like using a pdf printer. Other people don’t seem to be having this issue, so I assume its a problem with my virtual machine.

Running Ubuntu 16.04.6 LTS

PDF print requests are directed to the wkhtmltopdf standalone command utility on the server. A search for posts like this can help you troubleshoot Wkhtmltopdf bug

The log files can be found in the logs/ directory in frappe-bench (the directory where all server bench commands are run), so for example

frappe@ubuntu1804lts:~/frappe-bench$ pwd

frappe@ubuntu1804lts:~/frappe-bench$ bench version
erpnext 12.6.0
frappe 12.4.1

frappe@ubuntu1804lts:~/frappe-bench$ find logs -name ‘*.log’ | xargs ls -al
-rw-r–r-- 1 frappe frappe 18720 Apr 1 06:42 logs/bench.log
-rw-r–r-- 1 frappe frappe 77824 May 5 00:33 logs/frappe.log
-rw-r–r-- 1 root root 21143552 Mar 19 16:24 logs/node-socketio.error.log
-rw-r–r-- 1 root root 162368 May 4 19:47 logs/node-socketio.log
-rw-r–r-- 1 root root 0 Jan 12 01:08 logs/redis-cache.error.log
-rw-r–r-- 1 root root 62636 May 4 19:46 logs/redis-cache.log
-rw-r–r-- 1 root root 0 Jan 12 01:08 logs/redis-queue.error.log
-rw-r–r-- 1 root root 64560 May 4 19:46 logs/redis-queue.log
-rw-r–r-- 1 root root 0 Jan 12 01:08 logs/redis-socketio.error.log
-rw-r–r-- 1 root root 62636 May 4 19:46 logs/redis-socketio.log
-rw-r–r-- 1 root root 0 Jan 12 01:08 logs/schedule.error.log
-rw-r–r-- 1 root root 9803 Feb 3 20:45 logs/schedule.log
-rw-r–r-- 1 root root 37860139 May 4 19:47 logs/web.error.log
-rw-r–r-- 1 root root 63973 Apr 22 15:46 logs/web.log
-rw-r–r-- 1 root root 44925493 May 5 00:32 logs/worker.error.log
-rw-r–r-- 1 root root 0 Jan 12 01:08 logs/worker.log

edit: Other logs to check include those that relate to the OS here:

root@ubuntu:~# ls -alt /var/log
total 3784
-rw-r----- 1 syslog adm 161644 May 5 10:14 kern.log
-rw-r----- 1 syslog adm 22683 May 5 10:14 syslog
-rw-r----- 1 syslog adm 161644 May 5 10:14 ufw.log
-rw-r----- 1 syslog adm 8321 May 5 09:17 auth.log
-rw-r----- 1 syslog adm 3491 May 5 09:17 cron.log
drwx------ 2 root root 4096 May 5 08:05 letsencrypt

So it seems related to SSL. I found this thread that sounds like a similar issue. Timeout when trying to run a salary slip (payslip)

Normally I access my self hosted erpnext by https using my registered dns name. For fun I accessed erpnext using the local IP and http instead. Using http only, the pdf generation works perfectly. Any ideas why it would “hang” (it gives zero error messages) over https connection?

Thank you

That’s a good clue - so your issue may be host_name resolution

For remote server access to pdf that must be specified in your site_config.json

To check that try this:

frappe@ubuntu1804lts:~/frappe-bench$ bench show-config | grep host_name
host_name https://exampledomain.com

To add or change that try something like this:

bench set-confg host_name https://exampledomain.com

You can also edit site-config.json manually.

Clues like this will help

Wow! Setting that hostname fixed it. Thank you for the support; This is one awesome ERP system, and with such a good community for support gives it real value.

Thanks again,


1 Like

Thanks for your recognition Kevin.

Indeed yes, much of the success of ERPNext is thanks to this forum community spirit of volunteer contribution ‘pay it forward’ however not free support!

1 Like