Brian, On 1/11/16 5:14 PM, Tieman,Brian wrote: > I¹ve got a REST service that¹s backed by Hibernate calling MYSQL and using > org.apache.tomcat.jdbc.pool.DataSourceFactory for DB connections. The > connection pool is created with: > > <Resource driverClassName="com.mysql.jdbc.Driver" > username=³me" password=³my password" > factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" > name=³jdbc/MyDB" > type="javax.sql.DataSource" > url="jdbc:mysql://my.database.net" > validationQuery="select 1" > validationQueryTimeout="60" > testOnBorrow="true" > testWhileIdle="true" > removeAbandoned="true" > removeAbandonedTimeout="30" > suspectTimeout="15" > logAbandoned="true" > timeBetweenEvictionRunsMillis="5000" > minEvictableIdleTimeMillis="60000" > validationInterval="30000" > />
Hibernate is not involved in the above configuration. Is that what you were expecting? > It looks like the first record retrieved from the service is being stored > somehow. tomcat-jdbc definitely does not cache records. > I can alter the data retrieved by the first select but I¹ll > occasionally get the initial data back on a subsequent selects. After > much troubleshooting, it feels like the stale data is returned only when > my select is performed with the same connection (from the pool) as the > first select since the service started. I don¹t know how to tell for sure > that the initial connection is the one holding onto old data but the old > data is always the first data I¹ve read and it will be returned seemingly > randomly although the data in the underlying database is correct and we > have no caching turned on in hibernate. What happens if you issue a raw JDBC SELECT from a pooled connection without using hibernate? > My test procedure has been: > > 1) Start service > 2) Read record > 3) Change record > 4) Read record > 5) Repeat 4 > > > If nothing else is hitting the service (no concurrency) I never see stale > data. It¹s only when other clients are hitting the service that I > randomly get stale data returned. The stale data is always the first > record read and is only returned when attempting to read that record again. > > Has anyone ever seen anything like this? Ideas on where to troubleshoot? I've never seen anything like this, but I've never used hibernate. My knee-jerk reaction is that this is Hibernate-related, but you could also be using Hibernate incorrectly. What's the smallest test case you can built that still demonstrates this behavior? -chris --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org