arachnys/athenapdf

PDF generation timed out when running in interactive mode

nitinthewiz opened this issue · 1 comments

Hi,

This is an issue for athenapdf v2.16.0

I've been running the CLI rather successfully, but am trying to automate it in nodejs.

The simplest way would be to run the entire command using something like shelljs -

docker run -rm -v $(pwd):/converted/ arachnysdocker/athenapdf athenapdf html_files/1.html pdf/1.pdf

But I wanted to try out dockerode, which interacts with the Docker Remote API. The benefit is that I can check if athenapdf image exists and download it if it isn't before trying to run the command.

I noticed that my code simply fails -

libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted
PDF generation timed out.

Looking at how dockerode does it, it seems that instead of 'docker run', the docker API only allows to create the container, and then go in and do a container start.

This is akin to running this in interactive mode, so I ran athenapdf manually in interactive mode -

docker run --rm -it -v $(pwd):/converted/ arachnysdocker/athenapdf bash
root@640213146e37:/converted# /athenapdf/entrypoint.sh athenapdf html_files/1.html pdf/1.pdf --no-cache -M none
libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted
PDF generation timed out.

When I run the docker run command as given in the repo, it seems to work perfectly.

I'm wondering if this is a known restriction, and if there's a simple way of telling the docker container to allow the command to run in interactive mode too.

Could this have something to do with the xvfb? Maybe in interactive mode the container gets fooled into trying to show a display and that's why athenapdf seems to fail?

Further research - I did a hacky thing - I went into the container using interactive, then installed node, got the cli code from git, installed the dependencies using 'npm i'

and ran -

node /converted/cli/bin/athenapdf html_files/2.html pdf/2.pdf --no-cache -M none 

and it worked!

root@640213146e37:/converted# node /converted/cli/bin/athenapdf html_files/2.html pdf/2.pdf --no-cache -M none 
libudev: udev_has_devtmpfs: name_to_handle_at on /dev: Operation not permitted
Converted 'file:///converted/html_files/2.html' to PDF: 'pdf/2.pdf'
PDF Conversion: 1152.564ms

Clearly, this tells me that either the build process, or the way the docker image is setup, is interfering with the interactive running of the command.