-
Notifications
You must be signed in to change notification settings - Fork 366
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
ConcurrentModificationException #839
Comments
Now that is how you write a bug report. Kudos to you @JerryDevis. |
@JerryDevis - I guess I really should have asked first, but I really thought that you deserved a shout-out for this, so I gave you one on a LinkedIn post. Seriously, many people would have stopped at "I was using 2.5.2.0 and received a ConcurentModificationException" and given no further details. (I'm serious! Just ask @xeno6696 or @jeremiahjstacey.) So this is so refreshing to me, I just had to call you out as a good example. I hope you don't mind, but if you do, let me know and I'll delete it. But I figured it would be better hearing it from me than hearing it secondhand. Thanks again. |
Thank you so much @kwwall for the quick reply. I can't open the link of the post you mentioned, but I believe that's no problem. I am trying to give as much detail as I can so that you can see the problem I encountered. I am looking forward to the conclusion of this issue from you/your team. |
@JerryDevis - Well, I appreciate the details that you put into it. A screen shot of the LinkedIn post is attached if you want to see what I posted. @jeremiahjstacey - since this is in your code ( |
@kwwall The way I would want to fix this would be to remove the custom property file that I used before I understood the java LogManager configuration. Would we correct the ConcurrentMod by copying the keySet? Yes, absolutely. The problem is that this bug is actually only identifying 1/2 of the problem. So the question I have is how would you like to see this corrected? Option 1: Only Fix the ConcurrentModificationException listed in this bug and wait for the runtime exception to be filed later Option 2: Remove the esapi-java-logging.properties file and only support the javadocs on the java LogManager class. Option 2 is arguably "better", but will come with the expected feedback when the release drops and no one reads the release notes on the required configuration updates. I suppose there is a third option to double-down on the custom configuration and add support for observing changes to System Properties at runtime to account for the possible race condition on initialization. I'm not particularly fond of this option, but it is also a path that could be sustained. |
@jeremiahjstacey - I don't like Option 1 because I think the race condition issue that pops up could be way more subtle. A race condition may not even be noticed because unlike the But because you are spot-on regarding your observation to ESAPI users apparent aversion to read ESAPI release notes, I don't think that Option 2 goes far enough and I really don't want to set ourselves up to having users pose endless questions on Stack Overflow, on our Discussions list, as GH issues, and personal emails. But I also don't like the idea of observing changes to the System Properties to deal with this. So I'm thinking of an alternate approach. What if, upon initialization, you look to see if an esapi-java-logging.properties file exists, and if you find one, we throw a ConfigurationException with an error message that has a short error message and then refers them to a URL on our GitHub wiki for some TBD wiki page where you provide all the details of how they can fix it, one step of which would be to ultimately delete their local esapi-java-logging.properties file. That way (assuming the follow all the detailed steps), we stop them once, they read and follow the instructions, and the restart their application server and the problem goes away. Of course we will write appropriate release notes as well, but with an approach like this, it hopefully eliminate that need to share the fact that they ignored reading the release notes via email, GH issues, Discussions, etc. What do you think of that proposal? |
I think that works. The changes I think that implies would be:
Am I on the same page with this understanding? |
Yeah, that's pretty much it, but for most of the details of what they need to do, I would have the ConfigurationException message refer them to some new page over on our local GH wiki, at /~https://github.com/ESAPI/esapi-java-legacy/wiki. The advantage of that is we can make further changes / clarifications as needed there without having to update the release. For example if a new future Jakarta release decided to (for some insane reason) rename the JUL property from 'java.util.logging.config.file' to (say) 'jakarta.util.logging.config.file', we would not have to do a new release to account for that. Also having a wiki page gives us a short way to still respond to everyone who still persist on asking about it. But yeah, I think we're on the same page of understanding. |
/~https://github.com/ESAPI/esapi-java-legacy/wiki/Configuring-the-JavaLogFactory Generated, and stub content is provided based on previous comment. |
Removing support for esapi-java-logging.properties file from baseline. ConfigurationException is thrown if file is found on the path at runtime. Exception message links to a wiki page with instructions on how to configure the application instance.
* Issue #839 JavaLogFactory ConcMod Removing support for esapi-java-logging.properties file from baseline. ConfigurationException is thrown if file is found on the path at runtime. Exception message links to a wiki page with instructions on how to configure the application instance. * JavaLogFactory Cleanup Removing unused imports. Consolidating String duplication to a class constant.
Describe the bug
JavaLogFactory.java's readLoggerConfiguration function throws ConcurrentModificationException at this line
in a multi-threaded environment when another thread is concurrently setting system properties while ESAPI is iterating over system properties.
Specify what ESAPI version(s) you are experiencing this bug in
2.5.2.0
To Reproduce
Expected behavior
Proposed change: copy the
System.getProperties().keySet()
to a new collection and iterating over the new collection instead of the original one to avoid thread safety problem.Platform environment (please complete the following information)
The text was updated successfully, but these errors were encountered: