You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@uima.apache.org by "Marshall Schor (JIRA)" <de...@uima.apache.org> on 2018/04/17 14:46:00 UTC
[jira] [Commented] (UIMA-5763) UIMA: need a way to lock a CAS to
prevent user from releasing it prematurely
[ https://issues.apache.org/jira/browse/UIMA-5763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16440939#comment-16440939 ]
Marshall Schor commented on UIMA-5763:
--------------------------------------
Sounds reasonable.
I think the uima-as "contract" here is somewhat more specific: I assume the user must not do any operations with the CAS that create or modify Feature Structures, or any indexing operations, or a CAS Reset, or use this CAS as the target of some deserialize operation. So all of these should also throw exceptions if the user does them? Did I miss anything?
> UIMA: need a way to lock a CAS to prevent user from releasing it prematurely
> ----------------------------------------------------------------------------
>
> Key: UIMA-5763
> URL: https://issues.apache.org/jira/browse/UIMA-5763
> Project: UIMA
> Issue Type: New Feature
> Components: UIMA
> Reporter: Jerry Cwiklik
> Assignee: Marshall Schor
> Priority: Major
> Fix For: 3.0.1SDK, 2.10.3SDK
>
>
> UIMA-AS client supports an async style of sending CASes for processing to a remote service. When using sendCAS( CAS aCas), the code serializes CAS and dispatches it to the remote but keeps the CAS in a cache. When a reply comes, the cached CAS is used to deserialize a response. The contract is that the user code should not call CAS.release(). When a reply finally comes, the CAS is handed over to an application callback and upon return from the callback, the UIMA-AS releases the CAS.
> Problem: there is nothing to prevent user code to violate the contract. If CAS.release() is called while UIMA-AS client awaits reply (or during reply deserialization), bad things happen. In a specific use case, a NPE was thrown during deserialization and debugging was quite painful.
> Proposed solution: to protect integrity of a CAS need a way to lock/unlock it. Such facility can be added to CASImpl class. When a user code tries to call release() when a CAS is locked, the code should throw an exception (IllegalStateException or similar).
> WDYT?
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
Re: [jira] [Commented] (UIMA-5763) UIMA: need a way to lock a CAS to
prevent user from releasing it prematurely
Posted by Jaroslaw Cwiklik <cw...@apache.org>.
Yes, the CAS should not be changed by user code while in locked state.
On Tue, Apr 17, 2018 at 10:46 AM, Marshall Schor (JIRA) <dev@uima.apache.org
> wrote:
>
> [ https://issues.apache.org/jira/browse/UIMA-5763?page=
> com.atlassian.jira.plugin.system.issuetabpanels:comment-
> tabpanel&focusedCommentId=16440939#comment-16440939 ]
>
> Marshall Schor commented on UIMA-5763:
> --------------------------------------
>
> Sounds reasonable.
>
> I think the uima-as "contract" here is somewhat more specific: I assume
> the user must not do any operations with the CAS that create or modify
> Feature Structures, or any indexing operations, or a CAS Reset, or use this
> CAS as the target of some deserialize operation. So all of these should
> also throw exceptions if the user does them? Did I miss anything?
>
> > UIMA: need a way to lock a CAS to prevent user from releasing it
> prematurely
> > ------------------------------------------------------------
> ----------------
> >
> > Key: UIMA-5763
> > URL: https://issues.apache.org/jira/browse/UIMA-5763
> > Project: UIMA
> > Issue Type: New Feature
> > Components: UIMA
> > Reporter: Jerry Cwiklik
> > Assignee: Marshall Schor
> > Priority: Major
> > Fix For: 3.0.1SDK, 2.10.3SDK
> >
> >
> > UIMA-AS client supports an async style of sending CASes for processing
> to a remote service. When using sendCAS( CAS aCas), the code serializes CAS
> and dispatches it to the remote but keeps the CAS in a cache. When a reply
> comes, the cached CAS is used to deserialize a response. The contract is
> that the user code should not call CAS.release(). When a reply finally
> comes, the CAS is handed over to an application callback and upon return
> from the callback, the UIMA-AS releases the CAS.
> > Problem: there is nothing to prevent user code to violate the contract.
> If CAS.release() is called while UIMA-AS client awaits reply (or during
> reply deserialization), bad things happen. In a specific use case, a NPE
> was thrown during deserialization and debugging was quite painful.
> > Proposed solution: to protect integrity of a CAS need a way to
> lock/unlock it. Such facility can be added to CASImpl class. When a user
> code tries to call release() when a CAS is locked, the code should throw
> an exception (IllegalStateException or similar).
> > WDYT?
> >
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v7.6.3#76005)
>