-
Notifications
You must be signed in to change notification settings - Fork 179
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Fix thread synchronization issues #43
Comments
I am unable to reproduce this - did you run the test multiple times in separate JVM processes? Maybe I can use JMeter to generate enough load to force this issue to happen. |
No, just run test20Senders20x4RetrieversAtTheSameTime from your IDE. Maybe increase the number of threads by increasing num.
Probably there are more of them, though I already fixed some. |
Sonar reports 2 blocker issues "Methods "wait(...)", "notify()" and "notifyAll()" should never be called on Thread instances" for AbstractServer and Service. These issues should also be included. |
- Refactored Service into interface, as AbstractServer is the base implmentation. - Cleaned up Service methods (unused params etc.) - Switched startup loop-sleep-wait-with-timeout into notify-wait and simplified GreenMail#start()
- Removed obsolete waiting loop when opening server socket
- Cleanup of AbstractServer.run() : Removed obsolete notifyAll
- Make sure notifyAll is in synchronized block
- AbstactServer: First terminate server thread THEN the client threads
- Clear handlers when shutting down - Handle spurious wakeups in #waitTillRunning()
- Fixed ImapRequestLineReader ignoring EOF, causing potential thread hang/leak (eg. when running ImapServerTest.testRetreiveSimpleWithNonDefaultPassword() ): - ImapHandler cleanup (dead code, buffering, resource closing and handling socket/input stream close issue)
- Fixed profiling hotspot by caching immutable hashCode computation
- Always close connected store (GreenMailUtil.get/setQuota) - Sonar fixes
When closing, there can be a race between Handler thread and external closing of the connection
- Fixed server startup/shutdown race. This can cause still running services when quickly starting/stopping GreenMail.
Try to avoid startup wait timeouts by always notifying waiting threads
Always close server socket in run loop. Previously, GreenMail only closed server socket when stopping the server. This sometimes did not work when repeatedly starting/stopping the server using Circle CI (see Issue #69).
There are various issues in thread synchronization that are uncovered by the MultiRequestTest (execute multiple times and look at command line output). Those should be fixed. While doing this it might be useful to do a general refactoring of the protocol code.
The text was updated successfully, but these errors were encountered: