[ 
https://issues.apache.org/jira/browse/DERBY-6679?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Diogo Sousa updated DERBY-6679:
-------------------------------

    Description: 
In org.apache.derby.impl.services.monitor.BaseMonitor there might be an 
atomicity violation in method shutdown(), lines 181-206:

{quote}
                for (;;) {
                        synchronized (this) {
 181:                   position = services.size()  - 1;
                        if (position == 0)
                                break;
                               ...
                        }
                       ...
                }
               ...
206:          ((TopService) services.get(0)).shutdown();
{quote}

Between the execution of lines 181 and 206 a concurrent thread may remove the 
only remaining service, causing the access to "services" in line 206 to fail.

  was:
In org.apache.derby.impl.services.monitor.BaseMonitor there might be an 
atomicity violation in method shutdown(), lines 181-206:

{{monospaced}}
>               for (;;) {
>                       synchronized (this) {
>   181:                position = services.size()  - 1;
>                               if (position == 0)
>                                       break;
>                                 ...
>                       }
>                         ...
>               }
>               ...
>  206: ((TopService) services.get(0)).shutdown();
{{monospaced}}

Between the execution of lines 181 and 206 a concurrent thread may remove the 
only remaining service, causing the access to "services" in line 206 to fail.


> Possible Atomicity Violation in BaseMonitor.shutdown()
> ------------------------------------------------------
>
>                 Key: DERBY-6679
>                 URL: https://issues.apache.org/jira/browse/DERBY-6679
>             Project: Derby
>          Issue Type: Bug
>          Components: Services
>    Affects Versions: 10.10.2.0
>         Environment: all
>            Reporter: Diogo Sousa
>            Priority: Minor
>
> In org.apache.derby.impl.services.monitor.BaseMonitor there might be an 
> atomicity violation in method shutdown(), lines 181-206:
> {quote}
>               for (;;) {
>                       synchronized (this) {
>  181:                 position = services.size()  - 1;
>                       if (position == 0)
>                               break;
>                                ...
>                       }
>                        ...
>               }
>              ...
> 206:        ((TopService) services.get(0)).shutdown();
> {quote}
> Between the execution of lines 181 and 206 a concurrent thread may remove the 
> only remaining service, causing the access to "services" in line 206 to fail.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to