PsiBuilder.advance & ProcessCanceledException
Hi,
I'm debugging a nasty unbalanced PsiMarker problem in the BashSupport plugin.
The unbalanced marker seems to be caused by an ProcessCanceledException exception thrown in PsiBuilder.advance.
Code like:
//create marker
//advance builder
marker.done(...)
will leave an open marker if advance() throws an exceptions.
PsiBuilderImpl.advance calls ProgressIndicatorProvider.checkCanceled() which can throw a ProcessCanceledException .
Under which circumstances is the exception thrown?
Is there any way to work around this problem?
Developing for 11.x .
Thanks a lot,
Wallaby
请先登录再写评论。
This is interesting - I see this thrown a lot during symbol resolution, as well. I can see it mostly when debugging. Although it seems to retry, I'm not sure why this process should be being canceled?
Are catching it? You should rethrow it so your thread dies properly. It is a normal exception that kills jobs spun up by the daemon processing.
It is thrown for example when you are parsing a document and the document is changed - your parse is invalid and needs to be restarted.
Here's the code I have in my parser:
You can add -Didea.ProcessCanceledException=disabled to avoid that for
debugging.
The exception indeed is thrown for performance reasons and it should be
rethrown
On 2/16/2012 12:59 AM, wallaby.pouch wrote:
>
>
>
>
>
>
>
>
>
Thanks a lot for all the replies.
I did not catch the exception but it seems to be caused by code like this (in the PsiParser implementation):
marker = builder.mark()
try {
//parsing which may cause a ProcessCanceledException exception
} finally {
marker.done(root);
}
The finally block is called even if the exception was thrown and at this point the builder seems to be in an unusable state.
I removed the finally block and the problem seems to be fixed now.
Thanks!
Wallaby