2

I've got a Rails app which renders a few pdf files. Only one of them is not able to load with the error failed to load pdf document, until I restart the server. I've seen somebody mention about file size of the file.Yeah, I found out that my file that has an issue is much bigger that the other. It is about 500KB while the others are only around 100KB.

However, I've checked my server to see its default config and found out that there is no limit for the file size to be rendered.

my-ubuntu-server:~$ ulimit -aH

core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 7862
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 4096
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 7862
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

So, I think the issue might be caused by something else other than the file size. No matter what, if anybody advice me to take another look into file size, I'm also happy with that.

Environments:

Ubuntu 14.04.4 LTS

Ruby 2.3.3

gem 'rails', '4.2.2'
gem 'wicked_pdf', '~> 1.0', '>= 1.0.6'
gem 'wkhtmltopdf-binary-edge', '~> 0.12.3.0'
Pirun Seng
  • 443
  • 1
  • 4
  • 20
  • Can you try running `wkhtmltopdf http://your_dns.com/generate_pdf/1 new_file.pdf` in terminal ? I had a similar issue couple of months ago, and it was an issue with `wkhtmltopdf`. – Kedarnag Mukanahallipatna Aug 28 '18 at 03:01
  • 1
    I got this: `Loading pages (1/6) Error: Failed loading page http://my_dns/reports/1.pdf (sometimes it will work just to ignore this error with --load-error-handling ignore) QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once. Exit with code 1 due to network error: OperationCanceledError` – Pirun Seng Aug 28 '18 at 03:21
  • Can you try doing this ? `wkhtmltopdf https://google.com google.pdf`, as per the author comment of that link, you should get the error for this as well. – Kedarnag Mukanahallipatna Aug 28 '18 at 03:27
  • I'm afraid I don't get any errors running that. – Pirun Seng Aug 28 '18 at 03:32
  • Take a look at [this](https://github.com/wkhtmltopdf/wkhtmltopdf/issues/3241) – Kedarnag Mukanahallipatna Aug 28 '18 at 03:39
  • That does not help. I updated my question by removing the word **randomly**. The file does not load until I have to restart the server every time of deployment. Again, the other files (different records/body content) always display. – Pirun Seng Aug 28 '18 at 04:25
  • Did you try upgrading the version of `wkhtmltopdf` ? – Kedarnag Mukanahallipatna Aug 28 '18 at 04:32

0 Answers0