jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "sivakumar kalyanaraman (JIRA)" <j...@apache.org>
Subject [jira] Commented: (JCR-990) Deadlock shutting down transient repository
Date Fri, 19 Dec 2008 11:45:44 GMT

    [ 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.


Mime
View raw message