You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Andrus Adamchik (JIRA)" <ji...@apache.org> on 2016/09/05 10:54:21 UTC

[jira] [Commented] (CAY-2110) Obfuscated exception when processing iterated results

    [ https://issues.apache.org/jira/browse/CAY-2110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15464732#comment-15464732 ] 

Andrus Adamchik commented on CAY-2110:
--------------------------------------

Ok , it turns out this happens in the context of LinkMove (https://github.com/nhl/link-move), that uses Cayenne for both source and target operations (i.e. 2 different data sources). Everything happens in the context of a source transaction (that encloses select iterator and will exist until the iterator is closed). Target operations reuse this transaction (with its own connections). So if the target ObjectContext is explicitly rolled back, then this entire transaction is marked as rolled back... So while we may need to fix the issue as described above, I think that:

1. LinkMove will need to separate transactions for source and target
2. Perhaps Cayenne needs a different transaction model that does not assume a single transaction per thread? At the minimum different Cayenne stacks will need to be separated from each other for tx handling purposes.

> Obfuscated exception when processing iterated results
> -----------------------------------------------------
>
>                 Key: CAY-2110
>                 URL: https://issues.apache.org/jira/browse/CAY-2110
>             Project: Cayenne
>          Issue Type: Bug
>    Affects Versions: 4.0.M3
>            Reporter: Andrus Adamchik
>            Assignee: Andrus Adamchik
>            Priority: Minor
>
> This was reported by a user. I don't have a full test case yet, but I think we can easily build it. Iterated query throws the following exception:
> org.apache.cayenne.CayenneRuntimeException: [v.4.0.M4.4937cd0 May 25 2016 12:27:14] java.lang.IllegalStateException: Transaction must have 'STATUS_ACTIVE' to be committed. Current status: STATUS_MARKED_ROLLEDBACK
> 	at org.apache.cayenne.access.TransactionResultIteratorDecorator.close(TransactionResultIteratorDecorator.java:67)
> ...
> Caused by: java.lang.IllegalStateException: Transaction must have 'STATUS_ACTIVE' to be committed. Current status: STATUS_MARKED_ROLLEDBACK
> 	at org.apache.cayenne.tx.BaseTransaction.commit(BaseTransaction.java:126)
> 	at org.apache.cayenne.access.TransactionResultIteratorDecorator.close(TransactionResultIteratorDecorator.java:60)
> 	... 12 more
> What seems to happen is an uncaught exception during iteration, and a call to "close" in the "finally" method of the iterator attempts to commit transaction that is already in the ROLLBACK state. Looks like we need to check transaction state inside 'TransactionResultIteratorDecorator.close()' before committing... If it is not ready to be committed, it should be rolled back.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)