-
Notifications
You must be signed in to change notification settings - Fork 306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FISH-766 Improper session synchronization of session map #4479
Merged
MeroRai
merged 8 commits into
payara:master
from
sgflt:issue-4280-improper-session-synchronization
Nov 18, 2020
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5d6e7cd
#4280 Fixed synchronization issue
sgflt 3215ce9
#4281 Added final modifier to field
sgflt 6c64922
Merge remote-tracking branch 'upstream/master' into issue-4280-improp…
sgflt b298f29
#4280 Replaced HashMap by ConcurrentHashMap in SingleSignOn
sgflt a00f866
#4280 clean up code in GlassFishSingleSignOn
sgflt 1754479
#4280 Fixed unwanted double expiration
sgflt dc43453
#4280 Deleted unused variable
sgflt bef9a82
#4280 Fixed contract violation of findSessions
sgflt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
110 changes: 56 additions & 54 deletions
110
appserver/web/web-core/src/main/java/org/apache/catalina/Manager.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -669,24 +669,23 @@ public void writeSessions(OutputStream os, boolean doExpire) | |
} | ||
|
||
// Write the number of active sessions, followed by the details | ||
StandardSession[] currentStandardSessions = null; | ||
final StandardSession[] currentStandardSessions; | ||
synchronized (sessions) { | ||
if (log.isLoggable(Level.FINE)) | ||
log.log(Level.FINE, "Unloading {0} sessions", sessions.size()); | ||
try { | ||
// START SJSAS 6375689 | ||
for (Session actSession : findSessions()) { | ||
for (final Session actSession : findSessions()) { | ||
StandardSession session = (StandardSession) actSession; | ||
session.passivate(); | ||
} | ||
// END SJSAS 6375689 | ||
Session[] currentSessions = findSessions(); | ||
int size = currentSessions.length; | ||
final List<Session> currentSessions = findSessions(); | ||
int size = currentSessions.size(); | ||
currentStandardSessions = new StandardSession[size]; | ||
oos.writeObject(size); | ||
for (int i = 0; i < size; i++) { | ||
StandardSession session = | ||
(StandardSession) currentSessions[i]; | ||
final StandardSession session = (StandardSession) currentSessions.get(i); | ||
currentStandardSessions[i] = session; | ||
/* SJSAS 6375689 | ||
session.passivate(); | ||
|
@@ -882,21 +881,19 @@ public void stop(boolean isShutdown) throws LifecycleException { | |
} | ||
|
||
// Expire all active sessions and notify their listeners | ||
Session sessions[] = findSessions(); | ||
if (sessions != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nullcheck for broken contract removed |
||
for (Session session : sessions) { | ||
if (!session.isValid()) { | ||
continue; | ||
} | ||
try { | ||
session.expire(); | ||
} catch (Throwable t) { | ||
// Ignore | ||
} finally { | ||
// Measure against memory leaking if references to the session | ||
// object are kept in a shared field somewhere | ||
session.recycle(); | ||
} | ||
final List<Session> sessions = findSessions(); | ||
for (final Session session : sessions) { | ||
if (!session.isValid()) { | ||
continue; | ||
} | ||
try { | ||
session.expire(); | ||
} catch (Throwable t) { | ||
// Ignore | ||
} finally { | ||
// Measure against memory leaking if references to the session | ||
// object are kept in a shared field somewhere | ||
session.recycle(); | ||
} | ||
} | ||
|
||
|
@@ -985,16 +982,14 @@ public void processExpires() { | |
|
||
long timeNow = System.currentTimeMillis(); | ||
|
||
Session[] sessions = findSessions(); | ||
if (sessions != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nullcheck for broken contract removed |
||
for (Session session : sessions) { | ||
StandardSession sess = (StandardSession) session; | ||
if (sess.lockBackground()) { | ||
try { | ||
sess.isValid(); | ||
} finally { | ||
sess.unlockBackground(); | ||
} | ||
final List<Session> sessions = findSessions(); | ||
for (final Session session : sessions) { | ||
final StandardSession sess = (StandardSession) session; | ||
if (sess.lockBackground()) { | ||
try { | ||
sess.isValid(); | ||
} finally { | ||
sess.unlockBackground(); | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
broken contract fixed