403 Connection not available

I have very small memory footprint to work with 1 GB. I have a long polling process that seems to create a memory leak which I haven’ been able to diagnose/correct. I am using commandbox. It runs for about 3 weeks and crashes.

Lucee crashes from running out of memory. I get the 403 Connection not available if I do a http request to it.

So my question is: what is the best way to check for this and restart lucee/commandbox? I know I can curl it every min and check for the output with a cron/bash . I have commandbox/lucee running as a systemd service but it does not auto restart.

I am curious if there is a better way to detect the memory crash in lucee and restart it, if there is any mechanism in lucee or commandbox to do this, or what you would do?

Let me know what you think. Thanks.

Pull a heap dump of the java process before it crashes, or add the JVM arg to dump the heap on crash and then analyze it to see what’s eating it up. You may be able to adjust your code to fix the leak. Or you may find a Lucee bug :slight_smile:

Let me know if you need help with either of those. Adding custom JVM args to your box process can be done with a box.l4j.ini file in the same directory as the box.exe binary. To manually capture the heap, install a JDK and run

jmap -dump:format=b,file=<file_name> <pid>

I get a file written to the root directory hs_err_pid21368.log (125.6 KB). Does that have what your looking for?

So what my code is doing is reading a controller (modbus). Every min it kicks of a cfthread that does a http post to aws. (thread action="run). I think they are getting hung up and not closing.