Closed MislavSag closed 3 months ago
@MislavSag I don't see the actual code, but my suspicion based on the Docker
file is that you may be using some very convoluted way to send emails involving Java which is not possible if you initialize the JVM too soon since you cannot fork a JVM. I would recommend some more sane way to send email such as sendmail
? If you really want to use a JVM, make sure you start it only after the fork, i.e. you must call .jinit()
in the handler (but initializing an entire JVM just to do something that it trivially done with a single command seems a bit of an overkill...).
Also be careful with Postgresql connections. Forks should not use single connection concurrently. So you might need to create connection within function which handles particular endpoint.
On Sat, 24 Feb 2024, 06:53 Simon Urbanek, @.***> wrote:
@MislavSag https://github.com/MislavSag I don't see the actual code, but my suspicion based on the Docker file is that you may be using some very convoluted way to send emails involving Java which is not possible if you initialize the JVM too soon since you cannot fork a JVM. I would recommend some more sane way to send email such as sendmail? If you really want to use a JVM, make sure you start it only after the fork, i.e. you must call .jinit() in the handler (but initializing an entire JVM just to do something that it trivially done with a single command seems a bit of an overkill...).
— Reply to this email directly, view it on GitHub https://github.com/rexyai/RestRserve/issues/206#issuecomment-1962104092, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHC5XLI5BA25FT3HJSSGRDYVEMYLAVCNFSM6AAAAABDWM5INCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRSGEYDIMBZGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
I have changed email dependency package. Now I use blastula instead of mailR. Blastula has only pandoc as system requirement. It works now. So, you are right, it seems there was a problem with init JAVa on cores. But as I see now, sendemailR have minimal dependency, so I will try with it too. Blastula have huge dependency.
@dselivanov , I am openeing and closing connection inside API function. It seems tome this is working as expected.
Hi,
I have first developed plumber API, but wasn't happy with stability and speed.
I have rewritten API using RestRserve. Localy everything is working as expected, but when I create docker image, the hangs at email ntification (sending an email through mailR). I am not sure if this is in anyway connected to this package, but I don't know what to try, so I am posting here if you can find the reason.
Here is the app.R file:
and here is the Dockerfile:
Here are the logs when I execute set_holdings:
I would like to add that I could send an email while I was using plumbe, with same docker iamge. That is why I thinkg there could be some strange reason it doesn't work because of RestRserve.