Which class is holding onto the broken connection and why? Does your MultiTenantConnectionProvider class normally get called to close the connection when errors do not occur? Is it the MultiTenantConnectionProvider.releaseAnyConnection(Connection) that is called normally to release the connection?
Or is it the WildFly connection pool management that normally
returns the MultiTenantConnectionProvider obtained connection to
the connection pool?
If you can simulate the failure on your local machine, you might enable TRACE logging as mentioned in the troubleshooting section https://docs.wildfly.org/31/Developer_Guide.html#troubleshooting. For this situation, you could enable TRACE LOGGING via:
<logger category="org.jboss.jca">
<level name="TRACE"/>
</logger>
<logger category="org.jboss.jpa">
<level name="TRACE"/>
</logger>
The org.jboss.jpa tracing might just show the persistence calls
which just better shows the application flow. The org.jboss.jca
tracing should show more details about the connection handling.
Also see instructions 1-4 in my comment on issue https://issues.redhat.com/browse/WFLY-19082?focusedId=24400493&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-24400493 that talks about setting additional trace out for connections which may also show more info that is relevant.
Scott
--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/54c2d0c9-a9ff-4446-83a2-5521408fb8fen%40googlegroups.com.
Hello, ok, so the situation is:probably due to WFLY-19082, a setSchema inside my AbstractMultiTenantConnectionProvider.getConnection() nowadays might throw a SQLException.
Former code (working since JBoss 7.2.0 ;-) did not account for an Exception to occur inside getConnection(), and thus failed to return the connection to the pool (just exiting getConnection() by exception).So using this workaround I can remedy the connection leak:@Override
public Connection getConnection(String identifier) throws SQLException {
String[] tenantCrowd = splitTenantToken(identifier);
Connection c = super.getConnection(tenantCrowd[0]);
try {
c.setSchema(tenantCrowd[1]);
} catch (Exception sqle) {
if (c!=null) {
log.warn("broken connection encountered in getConnection("+identifier+") - releasing manually. "+sqle);
releaseConnection(tenantCrowd[0], c);
throw sqle;
}
}
return c;
}Behaviour is a bit different than before, because since we can't pass on the (already-marked-for-rollback) tx, subsequent calls within the same TX now throw aGenericJDBCException: Unable to acquire JDBC Connectionbut this can't be helped probably, and the main thing is not to have a connection leak here.Any second thoughts?Cheers Tom.
--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/c1171da1-6225-4e33-b667-7a7dbebd21den%40googlegroups.com.
No i got
IJ031070: Transaction cannot proceed: STATUS_MARKED_ROLLBACK
Still imterested?
My interest in WFLY-19082 would only be if you also got the "IJ000152: Trying to return an unknown connection" failure as a cause for why c.setSchema(tenantCrowd[1]) fails sometimes. The reason being to understand that better. I think the interesting think to understand is as to why the Active JTA transaction was marked to rollback.
The "IJ031070: Transaction cannot proceed:
STATUS_MARKED_ROLLBACK" error is thrown to force the request being
processed to fail early/immediately with an error instead of
continuing to run possibly for a long time. Is there a previous
server.log error logged from the same thread as the one that gets
the "IJ031070: Transaction cannot proceed: STATUS_MARKED_ROLLBACK"
error?
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/1E5672D6-187A-4573-8273-31EDB6F9BA30%40teicher.net.
Sorry no IJ000152 here.
Tx is marked rollback only because I throw an Exception from EJB layer deliberately.
The (new) problem is just that I now cannot call setSchema on such a tx (which doesnt make sense IMHO - why should this be forbidden now...).
https://github.com/ironjacamar/ironjacamar/blob/9c7bda20b5c3a05acbc396db6db4e5e6eb4aec31/adapters/src/main/java/org/jboss/jca/adapters/jdbc/WrapperDataSource.java#L270
has the check if the JTA transaction has been marked as rollback
only that throws an exception to fail early (e.g. throw an
exception to halt the current application work in current
thread). In earlier versions, we didn't have that check so the
JTA transaction marked for rollback-only could go on running for a
long time.
Another workaround (in your code) could be to check if there is
an active JTA transaction and don't call setSchema() if there is
an active JTA transaction that has been marked for rollback-only.
Scott
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/C0229037-D0E3-418B-86C0-2D7083293F98%40teicher.net.
Tom,
Thanks for raising this discussion and your concern which likely
is also shared by others who have not reached out.
Well, previously transaction marked as read-only could go
on running, and performing read operations and doing stuff,
just not commit the result at the end.
This is desireable for e.g. an import job, that wants
to process all data (rows) and report a summary at the end.
Example: I need to import 1000 data rows, and 500 and 700
are bad. Previously, I got 998 good operations and 2 bad,
now I get 499 good and 501 bad.
And in the case of a AbstractMultiTenantConnectionProvider,
I cannot omit the call to setSchema, or the TX might read
data from the wrong Schema, i.e. wrong Tenant.
(The BigMac appearing the the BurgerKing sales, if you know
what I mean ;-)
I get it ;-)
I was under the impression, from WFLY-18253,
that from WF30 that would would again?
The (https://issues.redhat.com/browse/JBJCA-1473)
https://github.com/ironjacamar/ironjacamar/pull/775 change does
not change setSchema.
Thanks Scott,
>> Well, previously transaction marked as read-only could go
>> on running, and performing read operations and doing stuff,
>> just not commit the result at the end.
>>
>> This is desireable for e.g. an import job, that wants
>> to process all data (rows) and report a summary at the end.
>
> I understand and wonder if a new (datasource?) FAIL_ON_ROLLBACK
> configuration setting would help that would default to true but could be
> overridden to be false to get back the old behavior.
Well, I personally have no love for the new behavior at all ;-)
but of course a switch somewhere would be better than nothing.
IMHO a fail-early makes no sense for non-write operations.
That would be all set*ters in Connection (setSchema, setNetworkTimeout,
...) maybe except setSavePoint(...) and setReadOnly() ?
>> I was under the impression, from WFLY-18253,
>> that from WF30 that would would again?
> The (https://issues.redhat.com/browse/JBJCA-1473)
> https://github.com/ironjacamar/ironjacamar/pull/775 change does not
> change setSchema.
What a pity.
So we need a new issue here?
Thanks Cheers Tom.
--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/3a867445-380e-43f3-bf60-5be60239d4b8%40googlemail.com.