VEuPathDB / service-eda

Repo containing EDA web service
Apache License 2.0
0 stars 0 forks source link

possible race condition in job expiration leads to confusing 500 #50

Closed Foxcapades closed 1 month ago

Foxcapades commented 1 month ago

If multiple requests are accidentally made to the bulk compute job expiration endpoint there exists a race condition in the expiration controller that can lead to a harmless 500. To avoid this 500 the stream processing in ExpirationController::findJobs should ensure that target job objects are not null before testing the expected object's status property.

Foxcapades commented 1 month ago

Problematic snippet:

        // filter out already-expired jobs
        .filter(jobId -> !JobStatus.Expired.equals(AsyncPlatform.getJob(jobId).getStatus()))

AsyncPlatform.getJob(...) may return null, causing .getStatus() to lead to an NPE.