java.lang.RuntimeException: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215]

JIRA | Carlos Silva | 2 years ago
  1. 0

    I found this interesting issue with session timeouts/logouts and data import. When we start a data import operation (doesn't matter the type), the actual work is done in a separate in a separate thread. At some point in the import process, the credentials/session is checked (actually done in SecuredDatasource.getValueTable). The delay between the start of the job and this moment depends on the amount of rows/data being imported. When the data to import is small, there is no problem, but when the data file is 'big', and i mean more than 50k rows (for example), there is a change the Opal session timed out, or simply the used logged out, and then the import fails. From the design point of view, i would expect the jobs to be really autonomous, and be able to finish without the need of an active session. Because of this late authorization check in SecuredDatasource, that is not the case. Some kind of session heartbeat solution only works for timeouts, but not for logouts, so probably we must to all the permission checks even before starting the job. Here the stack traces for both the timeout and logout: {code} 1747456 [pool-1-thread-3] INFO org.obiba.magma.support.DatasourceCopier - Copying ValueTable '500k' to 'sesidev288.500k' (copyMetadata=true, copyValues=false). 1755398 [pool-1-thread-3] ERROR org.obiba.opal.shell.commands.ImportCommand - Runtime error while importing data java.lang.RuntimeException: org.apache.shiro.session.ExpiredSessionException: Session with id [5601dd9c-072c-44e7-9126-15b8c29ca98a] has expired. Last access time: 2/18/15 11:07 AM. Current time: 2/18/15 11:21 AM. Session timeout is set to 120 seconds (2 minutes) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:157) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:105) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:87) at org.obiba.opal.shell.commands.ImportCommand.importFromTables(ImportCommand.java:155) at org.obiba.opal.shell.commands.ImportCommand.executeImports(ImportCommand.java:89) at org.obiba.opal.shell.commands.ImportCommand.execute(ImportCommand.java:68) ... Caused by: org.apache.shiro.session.ExpiredSessionException: Session with id [5601dd9c-072c-44e7-9126-15b8c29ca98a] has expired. Last access time: 2/18/15 11:07 AM. Current time: 2/18/15 11:21 AM. Session timeout is set to 120 seconds (2 minutes) at org.apache.shiro.session.mgt.SimpleSession.validate(SimpleSession.java:292) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doValidate(AbstractValidatingSessionManager.java:186) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.validate(AbstractValidatingSessionManager.java:143) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:120) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:108) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:112) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:209) at org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.java:141) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.java:469) at org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.java:153) at org.apache.shiro.subject.support.DelegatingSubject.hasPrincipals(DelegatingSubject.java:126) at org.apache.shiro.subject.support.DelegatingSubject.isPermitted(DelegatingSubject.java:158) at org.obiba.magma.security.shiro.ShiroAuthorizer.isPermitted(ShiroAuthorizer.java:21) at org.obiba.magma.security.SecuredDatasource.authzReadTable(SecuredDatasource.java:68) at org.obiba.magma.security.SecuredDatasource.getValueTable(SecuredDatasource.java:30) at org.obiba.magma.support.DatasourceCopier.copy(DatasourceCopier.java:214) at org.obiba.magma.support.MultithreadedDatasourceCopier.copyVariables(MultithreadedDatasourceCopier.java:222) at org.obiba.magma.support.MultithreadedDatasourceCopier.write(MultithreadedDatasourceCopier.java:182) at org.obiba.magma.support.MultithreadedDatasourceCopier.copy(MultithreadedDatasourceCopier.java:172) at org.obiba.opal.core.service.CopyValueTablesLockingAction$CopyAction.execute(CopyValueTablesLockingAction.java:159) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate$1.doInTransactionWithoutResult(LockingActionTemplate.java:47) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.doInTransaction(LockingActionTemplate.java:42) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.execute(LockingActionTemplate.java:31) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:149) ... 13 more 1755434 [pool-1-thread-3] INFO org.obiba.opal.shell.commands.ImportCommand - Import failed in 13.81 min 1755434 [pool-1-thread-3] INFO org.obiba.opal.shell.service.impl.DefaultCommandJobService - CommandJob 3 finished executing {code} {code} 3647217 [pool-1-thread-5] INFO org.obiba.magma.support.DatasourceCopier - Copying ValueTable '500k' to 'carlos.500k' (copyMetadata=true, copyValues=false). 3654264 [pool-1-thread-5] ERROR org.obiba.opal.shell.commands.ImportCommand - Runtime error while importing data java.lang.RuntimeException: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215] at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:157) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:105) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:87) at org.obiba.opal.shell.commands.ImportCommand.importFromTables(ImportCommand.java:155) at org.obiba.opal.shell.commands.ImportCommand.executeImports(ImportCommand.java:89) at org.obiba.opal.shell.commands.ImportCommand.execute(ImportCommand.java:68) ... Caused by: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215] at org.apache.shiro.session.mgt.eis.AbstractSessionDAO.readSession(AbstractSessionDAO.java:170) at org.apache.shiro.session.mgt.eis.CachingSessionDAO.readSession(CachingSessionDAO.java:261) at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSessionFromDataSource(DefaultSessionManager.java:236) at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession(DefaultSessionManager.java:222) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:118) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:108) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:112) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:209) at org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.java:141) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.java:469) at org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.java:153) at org.apache.shiro.subject.support.DelegatingSubject.hasPrincipals(DelegatingSubject.java:126) at org.apache.shiro.subject.support.DelegatingSubject.isPermitted(DelegatingSubject.java:158) at org.obiba.magma.security.shiro.ShiroAuthorizer.isPermitted(ShiroAuthorizer.java:21) at org.obiba.magma.security.SecuredDatasource.authzReadTable(SecuredDatasource.java:68) at org.obiba.magma.security.SecuredDatasource.getValueTable(SecuredDatasource.java:30) at org.obiba.magma.support.DatasourceCopier.copy(DatasourceCopier.java:214) at org.obiba.magma.support.MultithreadedDatasourceCopier.copyVariables(MultithreadedDatasourceCopier.java:222) at org.obiba.magma.support.MultithreadedDatasourceCopier.write(MultithreadedDatasourceCopier.java:182) at org.obiba.magma.support.MultithreadedDatasourceCopier.copy(MultithreadedDatasourceCopier.java:172) at org.obiba.opal.core.service.CopyValueTablesLockingAction$CopyAction.execute(CopyValueTablesLockingAction.java:159) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate$1.doInTransactionWithoutResult(LockingActionTemplate.java:47) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.doInTransaction(LockingActionTemplate.java:42) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.execute(LockingActionTemplate.java:31) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:149) ... 13 more 3654264 [pool-1-thread-5] INFO org.obiba.opal.shell.commands.ImportCommand - Import failed in 12.14 min {code}

    JIRA | 2 years ago | Carlos Silva
    java.lang.RuntimeException: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215]
  2. 0

    I found this interesting issue with session timeouts/logouts and data import. When we start a data import operation (doesn't matter the type), the actual work is done in a separate in a separate thread. At some point in the import process, the credentials/session is checked (actually done in SecuredDatasource.getValueTable). The delay between the start of the job and this moment depends on the amount of rows/data being imported. When the data to import is small, there is no problem, but when the data file is 'big', and i mean more than 50k rows (for example), there is a change the Opal session timed out, or simply the used logged out, and then the import fails. From the design point of view, i would expect the jobs to be really autonomous, and be able to finish without the need of an active session. Because of this late authorization check in SecuredDatasource, that is not the case. Some kind of session heartbeat solution only works for timeouts, but not for logouts, so probably we must to all the permission checks even before starting the job. Here the stack traces for both the timeout and logout: {code} 1747456 [pool-1-thread-3] INFO org.obiba.magma.support.DatasourceCopier - Copying ValueTable '500k' to 'sesidev288.500k' (copyMetadata=true, copyValues=false). 1755398 [pool-1-thread-3] ERROR org.obiba.opal.shell.commands.ImportCommand - Runtime error while importing data java.lang.RuntimeException: org.apache.shiro.session.ExpiredSessionException: Session with id [5601dd9c-072c-44e7-9126-15b8c29ca98a] has expired. Last access time: 2/18/15 11:07 AM. Current time: 2/18/15 11:21 AM. Session timeout is set to 120 seconds (2 minutes) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:157) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:105) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:87) at org.obiba.opal.shell.commands.ImportCommand.importFromTables(ImportCommand.java:155) at org.obiba.opal.shell.commands.ImportCommand.executeImports(ImportCommand.java:89) at org.obiba.opal.shell.commands.ImportCommand.execute(ImportCommand.java:68) ... Caused by: org.apache.shiro.session.ExpiredSessionException: Session with id [5601dd9c-072c-44e7-9126-15b8c29ca98a] has expired. Last access time: 2/18/15 11:07 AM. Current time: 2/18/15 11:21 AM. Session timeout is set to 120 seconds (2 minutes) at org.apache.shiro.session.mgt.SimpleSession.validate(SimpleSession.java:292) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doValidate(AbstractValidatingSessionManager.java:186) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.validate(AbstractValidatingSessionManager.java:143) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:120) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:108) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:112) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:209) at org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.java:141) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.java:469) at org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.java:153) at org.apache.shiro.subject.support.DelegatingSubject.hasPrincipals(DelegatingSubject.java:126) at org.apache.shiro.subject.support.DelegatingSubject.isPermitted(DelegatingSubject.java:158) at org.obiba.magma.security.shiro.ShiroAuthorizer.isPermitted(ShiroAuthorizer.java:21) at org.obiba.magma.security.SecuredDatasource.authzReadTable(SecuredDatasource.java:68) at org.obiba.magma.security.SecuredDatasource.getValueTable(SecuredDatasource.java:30) at org.obiba.magma.support.DatasourceCopier.copy(DatasourceCopier.java:214) at org.obiba.magma.support.MultithreadedDatasourceCopier.copyVariables(MultithreadedDatasourceCopier.java:222) at org.obiba.magma.support.MultithreadedDatasourceCopier.write(MultithreadedDatasourceCopier.java:182) at org.obiba.magma.support.MultithreadedDatasourceCopier.copy(MultithreadedDatasourceCopier.java:172) at org.obiba.opal.core.service.CopyValueTablesLockingAction$CopyAction.execute(CopyValueTablesLockingAction.java:159) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate$1.doInTransactionWithoutResult(LockingActionTemplate.java:47) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.doInTransaction(LockingActionTemplate.java:42) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.execute(LockingActionTemplate.java:31) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:149) ... 13 more 1755434 [pool-1-thread-3] INFO org.obiba.opal.shell.commands.ImportCommand - Import failed in 13.81 min 1755434 [pool-1-thread-3] INFO org.obiba.opal.shell.service.impl.DefaultCommandJobService - CommandJob 3 finished executing {code} {code} 3647217 [pool-1-thread-5] INFO org.obiba.magma.support.DatasourceCopier - Copying ValueTable '500k' to 'carlos.500k' (copyMetadata=true, copyValues=false). 3654264 [pool-1-thread-5] ERROR org.obiba.opal.shell.commands.ImportCommand - Runtime error while importing data java.lang.RuntimeException: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215] at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:157) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:105) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:87) at org.obiba.opal.shell.commands.ImportCommand.importFromTables(ImportCommand.java:155) at org.obiba.opal.shell.commands.ImportCommand.executeImports(ImportCommand.java:89) at org.obiba.opal.shell.commands.ImportCommand.execute(ImportCommand.java:68) ... Caused by: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215] at org.apache.shiro.session.mgt.eis.AbstractSessionDAO.readSession(AbstractSessionDAO.java:170) at org.apache.shiro.session.mgt.eis.CachingSessionDAO.readSession(CachingSessionDAO.java:261) at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSessionFromDataSource(DefaultSessionManager.java:236) at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession(DefaultSessionManager.java:222) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:118) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:108) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:112) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:209) at org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.java:141) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.java:469) at org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.java:153) at org.apache.shiro.subject.support.DelegatingSubject.hasPrincipals(DelegatingSubject.java:126) at org.apache.shiro.subject.support.DelegatingSubject.isPermitted(DelegatingSubject.java:158) at org.obiba.magma.security.shiro.ShiroAuthorizer.isPermitted(ShiroAuthorizer.java:21) at org.obiba.magma.security.SecuredDatasource.authzReadTable(SecuredDatasource.java:68) at org.obiba.magma.security.SecuredDatasource.getValueTable(SecuredDatasource.java:30) at org.obiba.magma.support.DatasourceCopier.copy(DatasourceCopier.java:214) at org.obiba.magma.support.MultithreadedDatasourceCopier.copyVariables(MultithreadedDatasourceCopier.java:222) at org.obiba.magma.support.MultithreadedDatasourceCopier.write(MultithreadedDatasourceCopier.java:182) at org.obiba.magma.support.MultithreadedDatasourceCopier.copy(MultithreadedDatasourceCopier.java:172) at org.obiba.opal.core.service.CopyValueTablesLockingAction$CopyAction.execute(CopyValueTablesLockingAction.java:159) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate$1.doInTransactionWithoutResult(LockingActionTemplate.java:47) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.doInTransaction(LockingActionTemplate.java:42) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.execute(LockingActionTemplate.java:31) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:149) ... 13 more 3654264 [pool-1-thread-5] INFO org.obiba.opal.shell.commands.ImportCommand - Import failed in 12.14 min {code}

    JIRA | 2 years ago | Carlos Silva
    java.lang.RuntimeException: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215]
  3. 0

    I found this interesting issue with session timeouts/logouts and data import. When we start a data import operation (doesn't matter the type), the actual work is done in a separate in a separate thread. At some point in the import process, the credentials/session is checked (actually done in SecuredDatasource.getValueTable). The delay between the start of the job and this moment depends on the amount of rows/data being imported. When the data to import is small, there is no problem, but when the data file is 'big', and i mean more than 50k rows (for example), there is a change the Opal session timed out, or simply the used logged out, and then the import fails. From the design point of view, i would expect the jobs to be really autonomous, and be able to finish without the need of an active session. Because of this late authorization check in SecuredDatasource, that is not the case. Some kind of session heartbeat solution only works for timeouts, but not for logouts, so probably we must to all the permission checks even before starting the job. Here the stack traces for both the timeout and logout: {code} 1747456 [pool-1-thread-3] INFO org.obiba.magma.support.DatasourceCopier - Copying ValueTable '500k' to 'sesidev288.500k' (copyMetadata=true, copyValues=false). 1755398 [pool-1-thread-3] ERROR org.obiba.opal.shell.commands.ImportCommand - Runtime error while importing data java.lang.RuntimeException: org.apache.shiro.session.ExpiredSessionException: Session with id [5601dd9c-072c-44e7-9126-15b8c29ca98a] has expired. Last access time: 2/18/15 11:07 AM. Current time: 2/18/15 11:21 AM. Session timeout is set to 120 seconds (2 minutes) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:157) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:105) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:87) at org.obiba.opal.shell.commands.ImportCommand.importFromTables(ImportCommand.java:155) at org.obiba.opal.shell.commands.ImportCommand.executeImports(ImportCommand.java:89) at org.obiba.opal.shell.commands.ImportCommand.execute(ImportCommand.java:68) ... Caused by: org.apache.shiro.session.ExpiredSessionException: Session with id [5601dd9c-072c-44e7-9126-15b8c29ca98a] has expired. Last access time: 2/18/15 11:07 AM. Current time: 2/18/15 11:21 AM. Session timeout is set to 120 seconds (2 minutes) at org.apache.shiro.session.mgt.SimpleSession.validate(SimpleSession.java:292) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doValidate(AbstractValidatingSessionManager.java:186) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.validate(AbstractValidatingSessionManager.java:143) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:120) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:108) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:112) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:209) at org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.java:141) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.java:469) at org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.java:153) at org.apache.shiro.subject.support.DelegatingSubject.hasPrincipals(DelegatingSubject.java:126) at org.apache.shiro.subject.support.DelegatingSubject.isPermitted(DelegatingSubject.java:158) at org.obiba.magma.security.shiro.ShiroAuthorizer.isPermitted(ShiroAuthorizer.java:21) at org.obiba.magma.security.SecuredDatasource.authzReadTable(SecuredDatasource.java:68) at org.obiba.magma.security.SecuredDatasource.getValueTable(SecuredDatasource.java:30) at org.obiba.magma.support.DatasourceCopier.copy(DatasourceCopier.java:214) at org.obiba.magma.support.MultithreadedDatasourceCopier.copyVariables(MultithreadedDatasourceCopier.java:222) at org.obiba.magma.support.MultithreadedDatasourceCopier.write(MultithreadedDatasourceCopier.java:182) at org.obiba.magma.support.MultithreadedDatasourceCopier.copy(MultithreadedDatasourceCopier.java:172) at org.obiba.opal.core.service.CopyValueTablesLockingAction$CopyAction.execute(CopyValueTablesLockingAction.java:159) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate$1.doInTransactionWithoutResult(LockingActionTemplate.java:47) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.doInTransaction(LockingActionTemplate.java:42) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.execute(LockingActionTemplate.java:31) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:149) ... 13 more 1755434 [pool-1-thread-3] INFO org.obiba.opal.shell.commands.ImportCommand - Import failed in 13.81 min 1755434 [pool-1-thread-3] INFO org.obiba.opal.shell.service.impl.DefaultCommandJobService - CommandJob 3 finished executing {code} {code} 3647217 [pool-1-thread-5] INFO org.obiba.magma.support.DatasourceCopier - Copying ValueTable '500k' to 'carlos.500k' (copyMetadata=true, copyValues=false). 3654264 [pool-1-thread-5] ERROR org.obiba.opal.shell.commands.ImportCommand - Runtime error while importing data java.lang.RuntimeException: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215] at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:157) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:105) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:87) at org.obiba.opal.shell.commands.ImportCommand.importFromTables(ImportCommand.java:155) at org.obiba.opal.shell.commands.ImportCommand.executeImports(ImportCommand.java:89) at org.obiba.opal.shell.commands.ImportCommand.execute(ImportCommand.java:68) ... Caused by: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215] at org.apache.shiro.session.mgt.eis.AbstractSessionDAO.readSession(AbstractSessionDAO.java:170) at org.apache.shiro.session.mgt.eis.CachingSessionDAO.readSession(CachingSessionDAO.java:261) at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSessionFromDataSource(DefaultSessionManager.java:236) at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession(DefaultSessionManager.java:222) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:118) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:108) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:112) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:209) at org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.java:141) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.java:469) at org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.java:153) at org.apache.shiro.subject.support.DelegatingSubject.hasPrincipals(DelegatingSubject.java:126) at org.apache.shiro.subject.support.DelegatingSubject.isPermitted(DelegatingSubject.java:158) at org.obiba.magma.security.shiro.ShiroAuthorizer.isPermitted(ShiroAuthorizer.java:21) at org.obiba.magma.security.SecuredDatasource.authzReadTable(SecuredDatasource.java:68) at org.obiba.magma.security.SecuredDatasource.getValueTable(SecuredDatasource.java:30) at org.obiba.magma.support.DatasourceCopier.copy(DatasourceCopier.java:214) at org.obiba.magma.support.MultithreadedDatasourceCopier.copyVariables(MultithreadedDatasourceCopier.java:222) at org.obiba.magma.support.MultithreadedDatasourceCopier.write(MultithreadedDatasourceCopier.java:182) at org.obiba.magma.support.MultithreadedDatasourceCopier.copy(MultithreadedDatasourceCopier.java:172) at org.obiba.opal.core.service.CopyValueTablesLockingAction$CopyAction.execute(CopyValueTablesLockingAction.java:159) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate$1.doInTransactionWithoutResult(LockingActionTemplate.java:47) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.doInTransaction(LockingActionTemplate.java:42) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.execute(LockingActionTemplate.java:31) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:149) ... 13 more 3654264 [pool-1-thread-5] INFO org.obiba.opal.shell.commands.ImportCommand - Import failed in 12.14 min {code}

    JIRA | 2 years ago | Carlos Silva
    java.lang.RuntimeException: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I found this interesting issue with session timeouts/logouts and data import. When we start a data import operation (doesn't matter the type), the actual work is done in a separate in a separate thread. At some point in the import process, the credentials/session is checked (actually done in SecuredDatasource.getValueTable). The delay between the start of the job and this moment depends on the amount of rows/data being imported. When the data to import is small, there is no problem, but when the data file is 'big', and i mean more than 50k rows (for example), there is a change the Opal session timed out, or simply the used logged out, and then the import fails. From the design point of view, i would expect the jobs to be really autonomous, and be able to finish without the need of an active session. Because of this late authorization check in SecuredDatasource, that is not the case. Some kind of session heartbeat solution only works for timeouts, but not for logouts, so probably we must to all the permission checks even before starting the job. Here the stack traces for both the timeout and logout: {code} 1747456 [pool-1-thread-3] INFO org.obiba.magma.support.DatasourceCopier - Copying ValueTable '500k' to 'sesidev288.500k' (copyMetadata=true, copyValues=false). 1755398 [pool-1-thread-3] ERROR org.obiba.opal.shell.commands.ImportCommand - Runtime error while importing data java.lang.RuntimeException: org.apache.shiro.session.ExpiredSessionException: Session with id [5601dd9c-072c-44e7-9126-15b8c29ca98a] has expired. Last access time: 2/18/15 11:07 AM. Current time: 2/18/15 11:21 AM. Session timeout is set to 120 seconds (2 minutes) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:157) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:105) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:87) at org.obiba.opal.shell.commands.ImportCommand.importFromTables(ImportCommand.java:155) at org.obiba.opal.shell.commands.ImportCommand.executeImports(ImportCommand.java:89) at org.obiba.opal.shell.commands.ImportCommand.execute(ImportCommand.java:68) ... Caused by: org.apache.shiro.session.ExpiredSessionException: Session with id [5601dd9c-072c-44e7-9126-15b8c29ca98a] has expired. Last access time: 2/18/15 11:07 AM. Current time: 2/18/15 11:21 AM. Session timeout is set to 120 seconds (2 minutes) at org.apache.shiro.session.mgt.SimpleSession.validate(SimpleSession.java:292) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doValidate(AbstractValidatingSessionManager.java:186) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.validate(AbstractValidatingSessionManager.java:143) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:120) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:108) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:112) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:209) at org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.java:141) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.java:469) at org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.java:153) at org.apache.shiro.subject.support.DelegatingSubject.hasPrincipals(DelegatingSubject.java:126) at org.apache.shiro.subject.support.DelegatingSubject.isPermitted(DelegatingSubject.java:158) at org.obiba.magma.security.shiro.ShiroAuthorizer.isPermitted(ShiroAuthorizer.java:21) at org.obiba.magma.security.SecuredDatasource.authzReadTable(SecuredDatasource.java:68) at org.obiba.magma.security.SecuredDatasource.getValueTable(SecuredDatasource.java:30) at org.obiba.magma.support.DatasourceCopier.copy(DatasourceCopier.java:214) at org.obiba.magma.support.MultithreadedDatasourceCopier.copyVariables(MultithreadedDatasourceCopier.java:222) at org.obiba.magma.support.MultithreadedDatasourceCopier.write(MultithreadedDatasourceCopier.java:182) at org.obiba.magma.support.MultithreadedDatasourceCopier.copy(MultithreadedDatasourceCopier.java:172) at org.obiba.opal.core.service.CopyValueTablesLockingAction$CopyAction.execute(CopyValueTablesLockingAction.java:159) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate$1.doInTransactionWithoutResult(LockingActionTemplate.java:47) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.doInTransaction(LockingActionTemplate.java:42) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.execute(LockingActionTemplate.java:31) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:149) ... 13 more 1755434 [pool-1-thread-3] INFO org.obiba.opal.shell.commands.ImportCommand - Import failed in 13.81 min 1755434 [pool-1-thread-3] INFO org.obiba.opal.shell.service.impl.DefaultCommandJobService - CommandJob 3 finished executing {code} {code} 3647217 [pool-1-thread-5] INFO org.obiba.magma.support.DatasourceCopier - Copying ValueTable '500k' to 'carlos.500k' (copyMetadata=true, copyValues=false). 3654264 [pool-1-thread-5] ERROR org.obiba.opal.shell.commands.ImportCommand - Runtime error while importing data java.lang.RuntimeException: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215] at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:157) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:105) at org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:87) at org.obiba.opal.shell.commands.ImportCommand.importFromTables(ImportCommand.java:155) at org.obiba.opal.shell.commands.ImportCommand.executeImports(ImportCommand.java:89) at org.obiba.opal.shell.commands.ImportCommand.execute(ImportCommand.java:68) ... Caused by: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215] at org.apache.shiro.session.mgt.eis.AbstractSessionDAO.readSession(AbstractSessionDAO.java:170) at org.apache.shiro.session.mgt.eis.CachingSessionDAO.readSession(CachingSessionDAO.java:261) at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSessionFromDataSource(DefaultSessionManager.java:236) at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession(DefaultSessionManager.java:222) at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:118) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:108) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupRequiredSession(AbstractNativeSessionManager.java:112) at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getAttribute(AbstractNativeSessionManager.java:209) at org.apache.shiro.session.mgt.DelegatingSession.getAttribute(DelegatingSession.java:141) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.session.ProxiedSession.getAttribute(ProxiedSession.java:121) at org.apache.shiro.subject.support.DelegatingSubject.getRunAsPrincipalsStack(DelegatingSubject.java:469) at org.apache.shiro.subject.support.DelegatingSubject.getPrincipals(DelegatingSubject.java:153) at org.apache.shiro.subject.support.DelegatingSubject.hasPrincipals(DelegatingSubject.java:126) at org.apache.shiro.subject.support.DelegatingSubject.isPermitted(DelegatingSubject.java:158) at org.obiba.magma.security.shiro.ShiroAuthorizer.isPermitted(ShiroAuthorizer.java:21) at org.obiba.magma.security.SecuredDatasource.authzReadTable(SecuredDatasource.java:68) at org.obiba.magma.security.SecuredDatasource.getValueTable(SecuredDatasource.java:30) at org.obiba.magma.support.DatasourceCopier.copy(DatasourceCopier.java:214) at org.obiba.magma.support.MultithreadedDatasourceCopier.copyVariables(MultithreadedDatasourceCopier.java:222) at org.obiba.magma.support.MultithreadedDatasourceCopier.write(MultithreadedDatasourceCopier.java:182) at org.obiba.magma.support.MultithreadedDatasourceCopier.copy(MultithreadedDatasourceCopier.java:172) at org.obiba.opal.core.service.CopyValueTablesLockingAction$CopyAction.execute(CopyValueTablesLockingAction.java:159) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate$1.doInTransactionWithoutResult(LockingActionTemplate.java:47) at org.springframework.transaction.support.TransactionCallbackWithoutResult.doInTransaction(TransactionCallbackWithoutResult.java:34) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.doInTransaction(LockingActionTemplate.java:42) at org.obiba.opal.core.magma.concurrent.LockingActionTemplate.execute(LockingActionTemplate.java:31) at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:149) ... 13 more 3654264 [pool-1-thread-5] INFO org.obiba.opal.shell.commands.ImportCommand - Import failed in 12.14 min {code}

    JIRA | 2 years ago | Carlos Silva
    java.lang.RuntimeException: org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215]
  6. 0

    [2.2.0] CSRF filter prevents the Global object to be initializated

    GitHub | 3 years ago | msarti
    java.lang.RuntimeException: There is no started application

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.RuntimeException

      org.apache.shiro.session.UnknownSessionException: There is no session with id [89d982c3-37f4-4356-84ad-d55cc5483215]

      at org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables()
    2. org.obiba.opal
      ImportCommand.execute
      1. org.obiba.opal.core.service.DataImportServiceImpl.copyValueTables(DataImportServiceImpl.java:157)
      2. org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:105)
      3. org.obiba.opal.core.service.DataImportServiceImpl.importData(DataImportServiceImpl.java:87)
      4. org.obiba.opal.shell.commands.ImportCommand.importFromTables(ImportCommand.java:155)
      5. org.obiba.opal.shell.commands.ImportCommand.executeImports(ImportCommand.java:89)
      6. org.obiba.opal.shell.commands.ImportCommand.execute(ImportCommand.java:68)
      6 frames