Commit fbc8d58
Backport the behavioral fix from dc57ffd ("Transaction bug - close
context in finally block", PR #852) which is on dtq-dev/customer/lindat
but missing from customer/zcu-data.
On the request error path a slow submission upload could leave its
Hibernate session bound to the Tomcat thread with a dirty, stale Item:
the upload throws before reaching context.commit(), and
DSpaceRequestContextFilter assigns its `context` local only AFTER
chain.doFilter, so on an exception the local stays null and its finally
skips the abort -> the session leaks. A later request on that thread then
flushes the stale Item as a full-row UPDATE (Item has no
@DynamicUpdate/@Version), reverting owning_collection->NULL and
in_archive->false while collection2item + handle survive -> the item
becomes an unsearchable orphan (e.g. handle 20.500.14592/107).
Wrap chain.doFilter in the outer StatelessAuthenticationFilter with a
try/finally that reads the Context from the request attribute and
abort()s it if still valid, cleaning up the leaked context the inner
filter missed. No-op on the normal success path.
Only the StatelessAuthenticationFilter hunk is ported; the diagnostic/CI
files in dc57ffd are omitted (they conflict and are not needed).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit ea6116e)
1 parent 84e930c commit fbc8d58
1 file changed
Lines changed: 17 additions & 1 deletion
File tree
- dspace-server-webapp/src/main/java/org/dspace/app/rest/security
dspace-server-webapp/src/main/java/org/dspace/app/rest/security/StatelessAuthenticationFilter.java
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
105 | | - | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
106 | 122 | | |
107 | 123 | | |
108 | 124 | | |
| |||
0 commit comments