[jboss-jira] [JBoss JIRA] (WFLY-2551) AS7.2 - JMX Datasource pool & jdbc statistics dissapear if you enable validation
Brian Stansberry (JIRA)
issues at jboss.org
Mon Jul 28 17:33:30 EDT 2014
[ https://issues.jboss.org/browse/WFLY-2551?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12988470#comment-12988470 ]
Brian Stansberry commented on WFLY-2551:
----------------------------------------
The cause of the problem is the way DataSourceStatisticsListener works with the Resource tree. The AbstractDataSourceAdd handler gets a reference to a Resource and then hands it off the DataSourceStatisticsListener. Thereafter that Resource instance has its state modified as the listener reacts to start/stop of the MSC service.
This behavior violates the design of the resource model, which doesn't allow leaking of references to the resource tree outside the control of the ModelController. Any time an operation modifies the resource tree, the entire tree is cloned, and then when the operation commits, that clone is published and made visible to other threads. This copy-on-write/publish-on-commit behavior provides a kind of REPEATABLE_READ semantic -- an op that is changing the model sees its changes, while concurrently executing reads do not see those changes until the first op commits and publishes them.
So, what happens:
1) In step 2 in my previous comment, AbstractDataSourceAdd gets a Resource instance and passes a ref to it to DataSourceStatisticsListener.
2) In step 3, the user invokes an op that writes the model. The result is the resource tree is cloned, and the ref held by DataSourceStatisticsListener is no longer a ref to a part of the current model. (Really, any write op at all, on any resource anywhere would have this effect.)
3) In step 4, the enable op triggers the DataSourceStatisticsListener. This causes the "statistics=jdbc" and "statistics=pool" children to be added to the now out-of-date Resource. This has no effect at all on the official model.
4) The problems seen in steps 5 and 6 are because the official model doesn't show the existence of the "statistics=jdbc" and "statistics=pool" children.
5) The read-resource op in step 7 happens to work because the handler for it is forgiving of the fact that there is no resource for the requested address.
I have thoughts on solutions, which I'll post later.
> AS7.2 - JMX Datasource pool & jdbc statistics dissapear if you enable validation
> --------------------------------------------------------------------------------
>
> Key: WFLY-2551
> URL: https://issues.jboss.org/browse/WFLY-2551
> Project: WildFly
> Issue Type: Bug
> Security Level: Public(Everyone can see)
> Components: JCA, JMX
> Reporter: Will Tatam
> Assignee: Stefano Maestri
>
> If you just create a basic datasource under AS 7.2 the you can view the current statistics about the pool under
> jboss.as:subsystem=datasources,data-source=mySQL,statistics=pool
> However, if you add the following then sometimes the statistics=pool and statistics=jdbc entries disspaear
> <validation><check-valid-connection-sql>select 1</check-valid-connection-sql></validation>
--
This message was sent by Atlassian JIRA
(v6.2.6#6264)
More information about the jboss-jira
mailing list