Hi,
I'm using SmartGWT Power Edition 4.0.
While developing a scheduler that can run 10 concurrent asynchronous jobs (can vary depending on thread pool size configuration), I noticed that some DSRequest operations were throwing exceptions of 2 kinds, thrown when DSRequest.execute() is called. Below traces only contain thread-related logs.
1st exception:
2nd exception:
I performed several tests and these exceptions are thrown every time but randomly, probably a race condition problem.
Related code:
Let me know if there is a safer way to call execution on DSRequest, or if it is a bug that requires a fix delivery.
Thanks in advance
Regards
Antoine
I'm using SmartGWT Power Edition 4.0.
While developing a scheduler that can run 10 concurrent asynchronous jobs (can vary depending on thread pool size configuration), I noticed that some DSRequest operations were throwing exceptions of 2 kinds, thrown when DSRequest.execute() is called. Below traces only contain thread-related logs.
1st exception:
Code:
=== 2013-09-16 17:46:40,639 [or-7] INFO DSResponse - [builtinApplication.null] DSResponse: List with 1 items === 2013-09-16 17:46:40,642 [or-7] DEBUG SQLDriver - Freeing SQLDriver dbConnection 1389771195 === 2013-09-16 17:46:40,642 [or-7] DEBUG SQLConnectionManager - About to close PoolGuardConnectionWrapper with hashcode "1389771195" === 2013-09-16 17:46:40,645 [or-7] DEBUG DSRequest - Caching instance 708 of DS eventDescriptor from DSRequest.getDataSource() === 2013-09-16 17:46:40,645 [or-7] DEBUG DeclarativeSecurity - Processing security checks for DataSource null, field null === 2013-09-16 17:46:40,645 [or-7] DEBUG AppBase - [builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application === 2013-09-16 17:46:40,645 [or-7] DEBUG AppBase - [builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation === 2013-09-16 17:46:40,645 [or-7] INFO SQLDataSource - [builtinApplication.null] Performing fetch operation with outputs: [AUDIT_ACTIVE] criteria: {ID:2503} values: {ID:2503} === 2013-09-16 17:46:40,646 [or-7] INFO SQLDataSource - [builtinApplication.null] derived query: SELECT $defaultSelectClause FROM $defaultTableClause WHERE $defaultWhereClause === 2013-09-16 17:46:40,648 [or-7] DEBUG PoolableSQLConnectionFactory - [builtinApplication.null] makeObject() created an unpooled Connection '1783471398' === 2013-09-16 17:46:40,648 [or-7] DEBUG SQLConnectionManager - [builtinApplication.null] Borrowed connection '1783471398' === 2013-09-16 17:46:40,648 [or-7] DEBUG SQLDriver - [builtinApplication.null] About to execute SQL query in 'FIRCO' using connection '1783471398' === 2013-09-16 17:46:40,648 [or-7] INFO SQLDriver - [builtinApplication.null] Executing SQL query on 'FIRCO': SELECT AUD_EVENT_DESCRIPTOR.AUDIT_ACTIVE FROM AUD_EVENT_DESCRIPTOR WHERE (AUD_EVENT_DESCRIPTOR.ID=2503) === 2013-09-16 17:46:40,649 [or-7] INFO DSResponse - [builtinApplication.null] DSResponse: List with 1 items === 2013-09-16 17:46:40,650 [or-7] DEBUG SQLDriver - Freeing SQLDriver dbConnection 1783471398 === 2013-09-16 17:46:40,650 [or-7] DEBUG SQLConnectionManager - About to close PoolGuardConnectionWrapper with hashcode "1783471398" === 2013-09-16 17:46:40,652 [or-7] ERROR com.fircosoft.cdb.server.scheduler.SchedulerAuditor - Could not log audit java.util.ConcurrentModificationException at java.util.Hashtable$Enumerator.next(Hashtable.java:1031) at java.util.HashMap.putAll(HashMap.java:523) at com.isomorphic.datasource.DataSource.getRelation(DataSource.java:3742) at com.isomorphic.datasource.DataSource.getRelation(DataSource.java:3723) at com.isomorphic.datasource.DataSource.getIncludeFromInfo(DataSource.java:4277) at com.isomorphic.datasource.BasicDataSource.init(BasicDataSource.java:511) at com.isomorphic.sql.SQLDataSource.init(SQLDataSource.java:242) at com.isomorphic.datasource.DataSource.initialize(DataSource.java:452) at com.isomorphic.datasource.BasicDataSource.fromConfig(BasicDataSource.java:166) at com.isomorphic.datasource.DataSource.fromConfig(DataSource.java:437) at com.isomorphic.datasource.FileSystemDSRepo.loadDS(FileSystemDSRepo.java:110) at com.isomorphic.datasource.DataSource.forName(DataSource.java:228) at com.isomorphic.datasource.DataSource.forName(DataSource.java:220) at com.isomorphic.datasource.DataSource.forName(DataSource.java:209) at com.isomorphic.datasource.PoolableDataSourceFactory.makeUnpooledObject(PoolableDataSourceFactory.java:130) at com.isomorphic.datasource.PoolableDataSourceFactory.makeObject(PoolableDataSourceFactory.java:138) at org.apache.commons.pool.impl.GenericKeyedObjectPool.borrowObject(GenericKeyedObjectPool.java:1179) at com.isomorphic.pool.PoolManager.borrowObject(PoolManager.java:84) at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:95) at com.isomorphic.datasource.DataSourceManager.getDataSource(DataSourceManager.java:86) at com.isomorphic.datasource.DSRequest.getDataSource(DSRequest.java:2073) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2254) at com.fircosoft.cdb.server.audit.BaseAuditor.logAudit(BaseAuditor.java:89)
Code:
=== 2013-09-16 17:46:41,050 [r-10] DEBUG SQLDataSource - [builtinApplication.null] add operation affected 1 rows === 2013-09-16 17:46:41,050 [r-10] INFO SQLDataSource - [builtinApplication.null] primaryKeys: {ID=3831} === 2013-09-16 17:46:41,051 [r-10] INFO SQLDataSource - [builtinApplication.null] FIRCO getLastRow(): using default operationBinding === 2013-09-16 17:46:41,051 [r-10] DEBUG Relation - [builtinApplication.null] Caching instance of fromDS 'auditLog' in the DSRequest map === 2013-09-16 17:46:41,052 [r-10] DEBUG Relation - [builtinApplication.null] Caching instance of toDS 'operator' in the DSRequest map === 2013-09-16 17:46:41,053 [r-10] DEBUG Relation - [builtinApplication.null] Caching instance of toDS 'eventDescriptor' in the DSRequest map === 2013-09-16 17:46:41,053 [r-10] DEBUG DeclarativeSecurity - [builtinApplication.null] Processing security checks for DataSource null, field null === 2013-09-16 17:46:41,053 [r-10] DEBUG DeclarativeSecurity - [builtinApplication.null] Processing security checks for DataSource null, field null === 2013-09-16 17:46:41,053 [r-10] DEBUG AppBase - [builtinApplication.null, builtinApplication.null] No userTypes defined, allowing anyone access to all operations for this application === 2013-09-16 17:46:41,053 [r-10] DEBUG AppBase - [builtinApplication.null, builtinApplication.null] No public zero-argument method named '_null' found, performing generic datasource operation === 2013-09-16 17:46:41,054 [r-10] DEBUG DataSourceDMI - [builtinApplication.null] Invocation threw exception java.lang.NullPointerException at com.isomorphic.sql.SQLJoinWhereClause.buildExpression(SQLJoinWhereClause.java:190) at com.isomorphic.sql.SQLJoinWhereClause.getSQLString(SQLJoinWhereClause.java:138) at com.isomorphic.sql.SQLDataSource.getClausesContext(SQLDataSource.java:2614) at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1426) at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:408) at com.isomorphic.sql.SQLDataSource.executeFetch(SQLDataSource.java:352) at com.isomorphic.datasource.DataSource.execute(DataSource.java:1444) at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:723) at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658) at com.isomorphic.application.AppBase.execute(AppBase.java:491) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2419) at com.fircosoft.cdb.server.audit.AuditLogServerObject.fetch(AuditLogServerObject.java:28) at sun.reflect.GeneratedMethodAccessor165.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:972) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:416) at com.isomorphic.datasource.DataSourceDMI.execute(DataSourceDMI.java:64) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2415) at com.isomorphic.sql.SQLDataSource.getLastRow(SQLDataSource.java:655) at com.isomorphic.sql.SQLDataSource.SQLExecute(SQLDataSource.java:1664) at com.isomorphic.sql.SQLDataSource.processRequest(SQLDataSource.java:408) at com.isomorphic.sql.SQLDataSource.executeAdd(SQLDataSource.java:360) at com.isomorphic.datasource.DataSource.execute(DataSource.java:1447) at com.isomorphic.application.AppBase.executeDefaultDSOperation(AppBase.java:723) at com.isomorphic.application.AppBase.executeAppOperation(AppBase.java:658) at com.isomorphic.application.AppBase.execute(AppBase.java:491) at com.isomorphic.datasource.DSRequest.execute(DSRequest.java:2419) at com.fircosoft.cdb.server.audit.BaseAuditor.logAudit(BaseAuditor.java:89)
Related code:
Code:
final DSRequest auditRequest = new DSRequest(DSAuditLog.DS_NAME, DataSource.OP_ADD); if (operatorId > 0) auditRequest.setFieldValue(DSAuditLog.CREATED_BY, operatorId); auditRequest.setFieldValue(DSAuditLog.EVENT_ID, eventId); auditRequest.setFieldValue(DSAuditLog.RELOBJ_ID, objectId); auditRequest.setFieldValue(DSAuditLog.RELOBJ_TYPE, objectType); auditRequest.setFieldValue(DSAuditLog.RELOBJ_LABEL, objectLabel); auditRequest.setFieldValue(DSAuditLog.DATA, data); auditRequest.execute();
Thanks in advance
Regards
Antoine
Comment