-
Notifications
You must be signed in to change notification settings - Fork 860
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
added MAX_TRIES to SetContents of NbClipboard as well #8024
base: master
Are you sure you want to change the base?
Conversation
Thanks for the suggested patch! Are you on a Windows machine yourself? If you are trying to solve #7051, I'd recommend the following:
This seems to be the only way to troubleshoot this particular bug. |
@eirikbakke Yes, I am using Windows and indeed I try to solve or improve on #7051. So how can I follow your recommended steps. Is it enough to simply replace the I think bootstrap.nbm in my Netbeans installation or do I have to do more? |
Here's what I usually do when I want to have multiple custom NetBeans builds available to test and switch between:
|
So I am now on a patched version of Apache Netbeans 23. I used this little program and got to 50 tries multiple times without a glitch: #3962 (comment). I had this problem before. |
if (i == (MAX_TRIES - 1) || (System.currentTimeMillis() + delay - start) > 1000L) { | ||
throw ex; | ||
} else { | ||
log.log(Level.INFO, "systemClipboard#getContents ISE, attempt {0}", i + 1); // NOI18N |
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.
Log message should say setContents instead of getContents here.
Thanks for testing! Seeing whether the change makes a difference or not over time is very useful here.
That's a good thing to test, in addition to regular IDE usage over some time. If you can, please try to switch to the NetBeans version that does not have the patch, and see if the test then starts producing the bug. I remember trying that particular test myself at some point without exhibiting the bug. Another good thing to check for is to see that and IllegalStateException is actually thrown for setContents every now and then. This is to make sure the patch actually has some effect. To see this you'd need to change the log message in the patch that currently reads "systemClipboard#getContents ISE, attempt {0}" to "systemClipboard#setContents ISE, attempt {0}", to distinguish it from the getContents case. setContents is a mutating operation unlike getContents, so I'd be a little more cautious about doing unconditional retries, unless we know that it fixes the bug. Probably we'd want to decrease the retry count a bit; though for testing purposes it can be useful to leave it as it is in the current version of the patch. |
Since in some previous commit the retry logic for getContents was rewritten, I was wondering, why this was not done with setContent. This PR does this.
However, the old version startet a setContents with a delay of 100 ms. So a setContents could possibly interfere, even another setContents, since a new task was created. Using this new retry logic this interference cannot happen.