Skip to content

/tmp/jrubyXXX.jar files are left in place by classloader if process is SIGKILLed #3352

@rtyler

Description

@rtyler

When JRuby is executing via jruby-complete or another embedded type use-case, and it loads jars of some form or another a number of /tmp/jruby*.jar files are created.

Under "normal" conditions these files stick around and are removed by something when the process is sent SIGTERM or SIGINT.

A SIGKILL however will result in the files littering the /tmp directory indefinitely.

Reproduction Steps

  • java -cp ./jruby-complete-9.0.1.0.jar org.jruby.Main -e "puts 'hello'; require 'openssl'; puts 'loaded'; sleep 60"
  • ls /tmp | grep -i jar
➜  ~  ls /tmp | grep -i jar
jruby2147863957306982519jopenssl.jar
jruby3032390121297627542bcpkix-jdk15on-1.50.jar
jruby6589611494165220974bcprov-jdk15on-1.50.jar
➜  ~  
  • kill process with SIGKILL

Suggested solutions

It's not clear to me whether these files are needed after the classes are loaded into the runtime or not. If they are not needed, we could employ a similar fix to #1237 which was fixed with jnr/jffi#13

If they are needed for the duration of the runtime, then it would at least be useful to write the files with the PID of the Java process or something similar so a user can safely remove ones that are stale or no longer needed

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions