You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2021/12/17 23:12:53 UTC

[GitHub] [netbeans] entlicher opened a new pull request #3379: [NETBEANS-6312] Assure that TokenHierarchy is called with Document's read lock.

entlicher opened a new pull request #3379:
URL: https://github.com/apache/netbeans/pull/3379


   The `TokenHierarchy.isActive()` is not called with the associated Document's read lock, as can be seen from the stack trace in the associated issue.
   This change adds read lock to `SyntaxHighlighting`, which makes `TokenHierarchy.isActive()` to be called with the read lock.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sdedic commented on a change in pull request #3379: [NETBEANS-6312] Assure that TokenHierarchy is called with Document's read lock.

Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #3379:
URL: https://github.com/apache/netbeans/pull/3379#discussion_r771918025



##########
File path: ide/editor.util/src/org/netbeans/lib/editor/util/swing/DocumentUtilities.java
##########
@@ -65,9 +65,9 @@
     
     private static final Object TYPING_MODIFICATION_KEY = new Object();
     
-    private static Field numReadersField;
+    private static volatile Field numReadersField;

Review comment:
       BTW is this necessary, strictly speaking ? The `nuimReadersField` may be eventually initialized several times (a thread that was already started at the time of the previous assignment could see `null`) - but the Field instance should point to the same data (?).  But bcs of number of invocations (and other heavy locking on Document) I guess it makes no difference between volatile/nonvolatile.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] entlicher commented on a change in pull request #3379: [NETBEANS-6312] Assure that TokenHierarchy is called with Document's read lock.

Posted by GitBox <gi...@apache.org>.
entlicher commented on a change in pull request #3379:
URL: https://github.com/apache/netbeans/pull/3379#discussion_r772246345



##########
File path: ide/editor.util/src/org/netbeans/lib/editor/util/swing/DocumentUtilities.java
##########
@@ -65,9 +65,9 @@
     
     private static final Object TYPING_MODIFICATION_KEY = new Object();
     
-    private static Field numReadersField;
+    private static volatile Field numReadersField;

Review comment:
       I've removed the wrong synchronization, it's up to the volatile flag only now. It can initialize multiple times, but after that it's just one volatile access.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] entlicher commented on a change in pull request #3379: [NETBEANS-6312] Assure that TokenHierarchy is called with Document's read lock.

Posted by GitBox <gi...@apache.org>.
entlicher commented on a change in pull request #3379:
URL: https://github.com/apache/netbeans/pull/3379#discussion_r772238820



##########
File path: ide/editor.util/src/org/netbeans/lib/editor/util/swing/DocumentUtilities.java
##########
@@ -65,9 +65,9 @@
     
     private static final Object TYPING_MODIFICATION_KEY = new Object();
     
-    private static Field numReadersField;
+    private static volatile Field numReadersField;

Review comment:
       I agree that the synchronization is wrong. Looking at it, I'll adjust it a bit...




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sdedic merged pull request #3379: [NETBEANS-6312] Assure that TokenHierarchy is called with Document's read lock.

Posted by GitBox <gi...@apache.org>.
sdedic merged pull request #3379:
URL: https://github.com/apache/netbeans/pull/3379


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sdedic commented on pull request #3379: [NETBEANS-6312] Assure that TokenHierarchy is called with Document's read lock.

Posted by GitBox <gi...@apache.org>.
sdedic commented on pull request #3379:
URL: https://github.com/apache/netbeans/pull/3379#issuecomment-997951539


   All clear, merging.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] sdedic commented on a change in pull request #3379: [NETBEANS-6312] Assure that TokenHierarchy is called with Document's read lock.

Posted by GitBox <gi...@apache.org>.
sdedic commented on a change in pull request #3379:
URL: https://github.com/apache/netbeans/pull/3379#discussion_r771918025



##########
File path: ide/editor.util/src/org/netbeans/lib/editor/util/swing/DocumentUtilities.java
##########
@@ -65,9 +65,9 @@
     
     private static final Object TYPING_MODIFICATION_KEY = new Object();
     
-    private static Field numReadersField;
+    private static volatile Field numReadersField;

Review comment:
       BTW is this necessary, strictly speaking ? The `nuimReadersField` may be eventually initialized several times (a thread that was already started at the time of the previous assignment could see `null`) - but the Field instance should point to the same data (?).  But bcs of number of invocations (and other heavy locking on Document) I guess it makes no difference between volatile/nonvolatile.
   
   On the other hand `synchronized (doc) {}` around static `numReaders|WritersField` is probably completely useless.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists