[jira] [Commented] (VELOCITY-965) Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue

2023-05-24 Thread Jira


[ 
https://issues.apache.org/jira/browse/VELOCITY-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17725811#comment-17725811
 ] 

Marinó A. Jónsson commented on VELOCITY-965:


* There is no need to share the Statement for fetching the timestamp as it just 
returns a value and not a Reader - so this particular error is easily fixed 
(the readLastModified method isn't even synchronized).
 * However, according to the stackoverflow discussion it seems that if the same 
Statement is executed twice the second query will close the previous ResultSet 
- so this implementation is not thread-safe even though the getResourceReader 
method is synchronized ... if two templates are being fetched at the same time 
the second query could easily close the first ResultSet for the first query 
before the Reader has finished reading.

> Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue
> --
>
> Key: VELOCITY-965
> URL: https://issues.apache.org/jira/browse/VELOCITY-965
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.3
>Reporter: Amrit
>Priority: Major
>
> Recently we migrated from Velocity 1.7 to Velocity 2.3. We see the below 
> error  intermittently which is a possible thread synchronization issue with 
> Velocity Engine. The resultset is getting closed while another thread is 
> making use of it.
> {noformat}
> 2023-04-15 10:36:33.472  ERROR [org.apache.velocity.loader.ds] 
> {344} - DataSourceResourceLoader: database problem while getting timestamp of 
> 'xyz_abc': 
> java.sql.SQLException: Closed Resultset: next
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.ensureOpen(InsensitiveScrollableResultSet.java:109)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.next(InsensitiveScrollableResultSet.java:398)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_ForwardOnlyResultSet.next(Unknown
>  Source) ~[CodeGenerator.class:12.2.1.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.readLastModified(DataSourceResourceLoader.java:326)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.getLastModified(DataSourceResourceLoader.java:240)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:446)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1677)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1656)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:314) 
> ~[velocity-engine-core-2.3.jar:2.3]
> {noformat}    
> Reference:
> https://stackoverflow.com/questions/2794167/is-resultset-thread-safe



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Commented] (VELOCITY-965) Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue

2023-05-24 Thread Jira


[ 
https://issues.apache.org/jira/browse/VELOCITY-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17725784#comment-17725784
 ] 

Marinó A. Jónsson commented on VELOCITY-965:


PR is a "Pull Request" for the git repository (see 
[https://github.com/apache/velocity-engine]) ... if you clone the project and 
fix the issue yourself, you can put it in a separate branch, push it to the git 
repository, and then create a pull request for it to be merged with the master 
branch.

> Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue
> --
>
> Key: VELOCITY-965
> URL: https://issues.apache.org/jira/browse/VELOCITY-965
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.3
>Reporter: Amrit
>Priority: Major
>
> Recently we migrated from Velocity 1.7 to Velocity 2.3. We see the below 
> error  intermittently which is a possible thread synchronization issue with 
> Velocity Engine. The resultset is getting closed while another thread is 
> making use of it.
> {noformat}
> 2023-04-15 10:36:33.472  ERROR [org.apache.velocity.loader.ds] 
> {344} - DataSourceResourceLoader: database problem while getting timestamp of 
> 'xyz_abc': 
> java.sql.SQLException: Closed Resultset: next
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.ensureOpen(InsensitiveScrollableResultSet.java:109)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.next(InsensitiveScrollableResultSet.java:398)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_ForwardOnlyResultSet.next(Unknown
>  Source) ~[CodeGenerator.class:12.2.1.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.readLastModified(DataSourceResourceLoader.java:326)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.getLastModified(DataSourceResourceLoader.java:240)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:446)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1677)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1656)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:314) 
> ~[velocity-engine-core-2.3.jar:2.3]
> {noformat}    
> Reference:
> https://stackoverflow.com/questions/2794167/is-resultset-thread-safe



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Commented] (VELOCITY-965) Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue

2023-05-24 Thread Amrit (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17725755#comment-17725755
 ] 

Amrit commented on VELOCITY-965:


Thanks for the comment. Sorry what do you mean by PR here?

> Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue
> --
>
> Key: VELOCITY-965
> URL: https://issues.apache.org/jira/browse/VELOCITY-965
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.3
>Reporter: Amrit
>Priority: Major
>
> Recently we migrated from Velocity 1.7 to Velocity 2.3. We see the below 
> error  intermittently which is a possible thread synchronization issue with 
> Velocity Engine. The resultset is getting closed while another thread is 
> making use of it.
> {noformat}
> 2023-04-15 10:36:33.472  ERROR [org.apache.velocity.loader.ds] 
> {344} - DataSourceResourceLoader: database problem while getting timestamp of 
> 'xyz_abc': 
> java.sql.SQLException: Closed Resultset: next
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.ensureOpen(InsensitiveScrollableResultSet.java:109)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.next(InsensitiveScrollableResultSet.java:398)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_ForwardOnlyResultSet.next(Unknown
>  Source) ~[CodeGenerator.class:12.2.1.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.readLastModified(DataSourceResourceLoader.java:326)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.getLastModified(DataSourceResourceLoader.java:240)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:446)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1677)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1656)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:314) 
> ~[velocity-engine-core-2.3.jar:2.3]
> {noformat}    
> Reference:
> https://stackoverflow.com/questions/2794167/is-resultset-thread-safe



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Commented] (VELOCITY-965) Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue

2023-05-24 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17725744#comment-17725744
 ] 

Michael Osipov commented on VELOCITY-965:
-

This is open source, you can provide a PR to address the issue. Moreover, you 
cannot expect anything since this is open source. If you want progress, do 
something.

> Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue
> --
>
> Key: VELOCITY-965
> URL: https://issues.apache.org/jira/browse/VELOCITY-965
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.3
>Reporter: Amrit
>Priority: Major
>
> Recently we migrated from Velocity 1.7 to Velocity 2.3. We see the below 
> error  intermittently which is a possible thread synchronization issue with 
> Velocity Engine. The resultset is getting closed while another thread is 
> making use of it.
> {noformat}
> 2023-04-15 10:36:33.472  ERROR [org.apache.velocity.loader.ds] 
> {344} - DataSourceResourceLoader: database problem while getting timestamp of 
> 'xyz_abc': 
> java.sql.SQLException: Closed Resultset: next
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.ensureOpen(InsensitiveScrollableResultSet.java:109)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.next(InsensitiveScrollableResultSet.java:398)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_ForwardOnlyResultSet.next(Unknown
>  Source) ~[CodeGenerator.class:12.2.1.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.readLastModified(DataSourceResourceLoader.java:326)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.getLastModified(DataSourceResourceLoader.java:240)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:446)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1677)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1656)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:314) 
> ~[velocity-engine-core-2.3.jar:2.3]
> {noformat}    
> Reference:
> https://stackoverflow.com/questions/2794167/is-resultset-thread-safe



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Commented] (VELOCITY-965) Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue

2023-05-24 Thread Amrit (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17725731#comment-17725731
 ] 

Amrit commented on VELOCITY-965:


Generally what is process to fix such issues for the Velocity project? Would 
someone be looking into this issue and can we expect a fix anytime?

> Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue
> --
>
> Key: VELOCITY-965
> URL: https://issues.apache.org/jira/browse/VELOCITY-965
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.3
>Reporter: Amrit
>Priority: Major
>
> Recently we migrated from Velocity 1.7 to Velocity 2.3. We see the below 
> error  intermittently which is a possible thread synchronization issue with 
> Velocity Engine. The resultset is getting closed while another thread is 
> making use of it.
> {noformat}
> 2023-04-15 10:36:33.472  ERROR [org.apache.velocity.loader.ds] 
> {344} - DataSourceResourceLoader: database problem while getting timestamp of 
> 'xyz_abc': 
> java.sql.SQLException: Closed Resultset: next
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.ensureOpen(InsensitiveScrollableResultSet.java:109)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.next(InsensitiveScrollableResultSet.java:398)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_ForwardOnlyResultSet.next(Unknown
>  Source) ~[CodeGenerator.class:12.2.1.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.readLastModified(DataSourceResourceLoader.java:326)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.getLastModified(DataSourceResourceLoader.java:240)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:446)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1677)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1656)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:314) 
> ~[velocity-engine-core-2.3.jar:2.3]
> {noformat}    
> Reference:
> https://stackoverflow.com/questions/2794167/is-resultset-thread-safe



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org



[jira] [Commented] (VELOCITY-965) Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue

2023-04-18 Thread Michael Osipov (Jira)


[ 
https://issues.apache.org/jira/browse/VELOCITY-965?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17713740#comment-17713740
 ] 

Michael Osipov commented on VELOCITY-965:
-

I took a brief look at the class. Something looks fishy to me: The class is a 
singleton, yet it shares the connection and both prepared statements outside of 
the scope of {{public synchronized Reader getResourceReader()}}. This doesn't 
feel right to me.

> Velocity 1.7 vs velocity 2.3: Getting thread synchronization issue
> --
>
> Key: VELOCITY-965
> URL: https://issues.apache.org/jira/browse/VELOCITY-965
> Project: Velocity
>  Issue Type: Bug
>  Components: Engine
>Affects Versions: 2.3
>Reporter: Amrit
>Priority: Major
>
> Recently we migrated from Velocity 1.7 to Velocity 2.3. We see the below 
> error  intermittently which is a possible thread synchronization issue with 
> Velocity Engine. The resultset is getting closed while another thread is 
> making use of it.
> {noformat}
> 2023-04-15 10:36:33.472  ERROR [org.apache.velocity.loader.ds] 
> {344} - DataSourceResourceLoader: database problem while getting timestamp of 
> 'xyz_abc': 
> java.sql.SQLException: Closed Resultset: next
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.ensureOpen(InsensitiveScrollableResultSet.java:109)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> oracle.jdbc.driver.InsensitiveScrollableResultSet.next(InsensitiveScrollableResultSet.java:398)
>  ~[ojdbc8.jar:12.2.0.1.0]
>     at 
> weblogic.jdbc.wrapper.ResultSet_oracle_jdbc_driver_ForwardOnlyResultSet.next(Unknown
>  Source) ~[CodeGenerator.class:12.2.1.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.readLastModified(DataSourceResourceLoader.java:326)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.loader.DataSourceResourceLoader.getLastModified(DataSourceResourceLoader.java:240)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.loadResource(ResourceManagerImpl.java:446)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.resource.ResourceManagerImpl.getResource(ResourceManagerImpl.java:346)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1677)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1656)
>  ~[velocity-engine-core-2.3.jar:2.3]
>     at 
> org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:314) 
> ~[velocity-engine-core-2.3.jar:2.3]
> {noformat}    
> Reference:
> https://stackoverflow.com/questions/2794167/is-resultset-thread-safe



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

-
To unsubscribe, e-mail: dev-unsubscr...@velocity.apache.org
For additional commands, e-mail: dev-h...@velocity.apache.org