-
Notifications
You must be signed in to change notification settings - Fork 26
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
Racecondition: Different requests get same response #583
Comments
see Pull Request #584 |
@dbaumann2, could you please upload some test artifacts that demonstrate the race condition? Thanks |
Unfortunately I have no automated test demonstrating the issue. Here is some logging output from our application. Response message with ID 21 is expected to have Message ID "urn:uuid:0e5b9323-7076-47ca-b0f6-9d34c17d6eaf" and therefore cannot be correlated by our application. This led to us investigating the code of the toolkit. Hope this helps to understand the issue. Message ID 21: Request, AdhocQueryRequest, MessageId urn:uuid:0e5b9323-7076-47ca-b0f6-9d34c17d6eaf |
I understand the issue but without a test procedure that can consistently reproduce the problem, I wouldn't be able to confirm the bug fix. |
Is a simple unit test sufficient or do you need an integration test? |
Any of those type of tests is fine as long as it shows the toolkit generated MessageID is incorrect. |
I built XDS Toolkit from your pull request, ran the load tests but according to the results in the screenshot below, the error condition still exists. The good news is that your test is able to confirm the issue you reported but I'm afraid the pull request code did not solve the issue. I am adding @andrewmccaffreynist to help look into the root cause of this issue. |
We did not take a deeper look at the code. It just seemed to be the relevant place, but we unfortunately did not have time to compile and deploy it yet. |
We did some more investigation and found the problematic place. It is the creation of When handling a request in We "fixed" this issue by adding a new // Installation.java#asFilenameBase
return val + "-"+ UUID.randomUUID(); Using the provided SoapUI project, we can see no errors anymore. However, we don't know the side effects this will have on the entire Toolkit. An additional improvement would be to not rely on I/O operations for the request/response handling. For example, |
After some more digging around, a more elegant solution would be to synchronize during the file event creation inside public class SimDb {
// ...
private static final Object fileLock = new Object();
//...
SimDb(SimId simId, String actor, String transaction, boolean openToLastTransaction) {
//...
if (openToLastTransaction) {
openMostRecentEvent(actor, transaction)
} else {
// SimDb Line: 115
File eventDir;
synchronized (fileLock) {
eventDate = new Date();
eventDir = mkEventDir(eventDate);
eventDir.mkdirs();
}
Serialize.out(new File(eventDir, "date.ser"), eventDate);
}
}
// ...
} |
@mratzenb Thanks for your investigation, I believe you have found the root cause of the reported issue. |
Additional details based on the investigation above: Second, as it was suggested as an "additional improvement", I agree that the request message validation can use an in-memory content reference rather than re-loading from it from the SimDB Event folder on disk. |
In the IgActorSimulator and IgxActorSimulator an AdhocQueryResponseGenerator is set to a field called ahqrg. This can lead to mixed up responses when multiple requests are handled in parallel.
The text was updated successfully, but these errors were encountered: