You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Carlos Sanchez (JIRA)" <ji...@apache.org> on 2007/06/28 00:44:26 UTC

[jira] Created: (JCR-990) Deadlock shutting down transient repository

Deadlock shutting down transient repository
-------------------------------------------

                 Key: JCR-990
                 URL: https://issues.apache.org/jira/browse/JCR-990
             Project: Jackrabbit
          Issue Type: Bug
          Components: locks
    Affects Versions: 1.3
            Reporter: Carlos Sanchez


calling JackrabbitRepository.shutdown this is the call stack

RepositoryImpl.shutdown
RepositoryImpl.doShutdown
then calls logout in all active sessions
for each session logout it calls TransientRepository.loggedOut
if there are no more sessions stopRepository() is called
stopRepository() calls again RepositoryImpl.shutdown, and shutdownLock.writeLock().acquire() hangs

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-990) Deadlock shutting down transient repository

Posted by "sivakumar kalyanaraman (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12658070#action_12658070 ] 

sivakumar kalyanaraman commented on JCR-990:
--------------------------------------------

By 
(1) allowing re-entrancy on the shutdownLock  and 
(2) selectively calling the various shutdown routines within doShutdown

you could avoid this issue.

These changes are made in RepositoryImpl.java

code for (1)
private final ReadWriteLock shutdownLock = new ReentrantWriterPreferenceReadWriteLock();

code for (2)

    private synchronized void doShutdown() {
        log.info("Shutting down repository...");

        // stop optional cluster node
        if (clusterNode != null) {
            clusterNode.stop();
        }

        // close active user sessions
        // (copy sessions to array to avoid ConcurrentModificationException;
        // manually copy entries rather than calling ReferenceMap#toArray() in
        // order to work around  http://issues.apache.org/bugzilla/show_bug.cgi?id=25551)
        SessionImpl[] sa;
        synchronized (activeSessions) {
            int cnt = 0;
            sa = new SessionImpl[activeSessions.size()];
            for (Iterator it = activeSessions.values().iterator(); it.hasNext(); cnt++) {
                sa[cnt] = (SessionImpl) it.next();
            }
        }
        for (int i = 0; i < sa.length; i++) {
            if (sa[i] != null) {
                sa[i].logout();
            }
        }
//**************************Check the disposed flag. 
// Due to the re-entrance issue, the last call to sa[i].logout (above) would have called the current method already
// and hence the code below should not be executed again, as these methods are not re-entrant. 
	if (! disposed) 
	{

                      // all code currently present, upto repLock.release()

                      }
   // the if block ends here...
        log.info("Repository has been shutdown");
    }



> Deadlock shutting down transient repository
> -------------------------------------------
>
>                 Key: JCR-990
>                 URL: https://issues.apache.org/jira/browse/JCR-990
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: locks
>    Affects Versions: 1.3
>            Reporter: Carlos Sanchez
>
> calling JackrabbitRepository.shutdown this is the call stack
> RepositoryImpl.shutdown
> RepositoryImpl.doShutdown
> then calls logout in all active sessions
> for each session logout it calls TransientRepository.loggedOut
> if there are no more sessions stopRepository() is called
> stopRepository() calls again RepositoryImpl.shutdown, and shutdownLock.writeLock().acquire() hangs

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (JCR-990) Deadlock shutting down transient repository

Posted by "Thomas Mueller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/JCR-990?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661921#action_12661921 ] 

Thomas Mueller commented on JCR-990:
------------------------------------

Hi Sivakumar,

The issue is Closed with the resolution "Won't Fix". 
Do you suggest to re-open the ticket?
If yes why?

Regards,
Thomas

> Deadlock shutting down transient repository
> -------------------------------------------
>
>                 Key: JCR-990
>                 URL: https://issues.apache.org/jira/browse/JCR-990
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: locks
>    Affects Versions: 1.3
>            Reporter: Carlos Sanchez
>
> calling JackrabbitRepository.shutdown this is the call stack
> RepositoryImpl.shutdown
> RepositoryImpl.doShutdown
> then calls logout in all active sessions
> for each session logout it calls TransientRepository.loggedOut
> if there are no more sessions stopRepository() is called
> stopRepository() calls again RepositoryImpl.shutdown, and shutdownLock.writeLock().acquire() hangs

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (JCR-990) Deadlock shutting down transient repository

Posted by "Carlos Sanchez (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/JCR-990?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carlos Sanchez closed JCR-990.
------------------------------

    Resolution: Won't Fix

Forget it, the problem is in the spring modules TransientRepositoryFactoryBean
http://opensource.atlassian.com/projects/spring/browse/MOD-372

> Deadlock shutting down transient repository
> -------------------------------------------
>
>                 Key: JCR-990
>                 URL: https://issues.apache.org/jira/browse/JCR-990
>             Project: Jackrabbit
>          Issue Type: Bug
>          Components: locks
>    Affects Versions: 1.3
>            Reporter: Carlos Sanchez
>
> calling JackrabbitRepository.shutdown this is the call stack
> RepositoryImpl.shutdown
> RepositoryImpl.doShutdown
> then calls logout in all active sessions
> for each session logout it calls TransientRepository.loggedOut
> if there are no more sessions stopRepository() is called
> stopRepository() calls again RepositoryImpl.shutdown, and shutdownLock.writeLock().acquire() hangs

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.