perwendel / spark

A simple expressive web framework for java. Spark has a kotlin DSL https://github.com/perwendel/spark-kotlin
Apache License 2.0
9.63k stars 1.56k forks source link

SparkJava 2.5 holding static files open? #1001

Closed davidfordaus closed 5 years ago

davidfordaus commented 6 years ago

It appears that even after a stop() SparkJava holds static files open?

Background:

Preferences:

Any thoughts would be appreciated and potentially we're happy to update SparkJava ourselves to achieve this, however we see both file handle leakage and the impact on the typical Dev cycle as reasons to fix the issue from within the core team.

tipsy commented 6 years ago

Have you tried using staticFiles.externalLocation(absPath); instead? I remember having a switch for that in the past:

if (Config.env == "dev") {
    staticFiles.externalLocation(absPath);
} else {
    staticFiles.location(classpathPath);
}

But I don't remember which version of Spark it was.

Even when using staticFiles.location(classpathPath);, if you're using IntelliJ or Eclipse a simple build/make should copy resources over to classpath, no need to restart the Java process.

toyg commented 5 years ago

Spark 2.5 has a a known vulnerability when using static files. You should upgrade to the latest build.