Commits
Tarun Sukhani authored 6f922c78fc5
fix(jobs): a job run inline joins its caller's invocation A job run with call() or run() from inside an action is on the request's own thread. It opened a second invocation there, and when it ended every plugin's teardown ran against the request's state: JobsPlugin dropped the after-request queue, so the request ended with a NullPointerException and a 500, and DBPlugin, JPAPlugin and ValidationPlugin closed the connection, the EntityManager and the validation errors the action was still using. The same happened to a job that ran another job inline. Job.call() now checks whether its thread already has an invocation open. If so, only the job's own body runs, under a job id like any other run: in the caller's transaction, with no plugin hook called a second time, and a failure is thrown to the caller. A job on a thread of its own (now(), in(), afterRequest(), the scheduler, synchronous start and stop jobs) is unchanged. Covered by InlineJobFunctionalTest against the real server with JPA; without the fix it also leaves JpaLazyPoolTest a leaked connection. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KDUoh3KhBpfjXn4rV6H356