You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@asterixdb.apache.org by "Yingyi Bu (JIRA)" <ji...@apache.org> on 2016/05/20 22:27:13 UTC

[jira] [Updated] (ASTERIXDB-1220) Race condition in AObjectPrinter singleton instance

     [ https://issues.apache.org/jira/browse/ASTERIXDB-1220?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Yingyi Bu updated ASTERIXDB-1220:
---------------------------------
    Assignee: Till Westmann  (was: Chris Hillery)

> Race condition in AObjectPrinter singleton instance
> ---------------------------------------------------
>
>                 Key: ASTERIXDB-1220
>                 URL: https://issues.apache.org/jira/browse/ASTERIXDB-1220
>             Project: Apache AsterixDB
>          Issue Type: Bug
>          Components: AsterixDB, Data Formats
>            Reporter: Wail Alkowaileet
>            Assignee: Till Westmann
>
> Hi,
> The bug appears clearly when two queries race to print their output using AObjectPrinter singleton in the same DataFormat.
> {noformat}
>             public void print(byte[] b, int start, int l, PrintStream ps) throws AlgebricksException {
>                 try {
>                     listAccessor.set(b, start, l);
>                     arg.first = ps;
>                     listAccessor.accept(printVisitor, arg);
>                 } catch (Exception ioe) {
>                     throw new AlgebricksException(ioe);
>                 }
>             }
> {noformat}
> Since there's only one instance of AObjectPrinter, this will be a critical section and things will lose track (such as ps and listAccessor).
> I think new printer should be instantiated for each query.
> To produce the problem:
> Running the query in two clients:
> {noformat}
> //As in runtimets/queries/open-closed/query-issue55.3.query.aql
> for $x in [[1,3],[4,5,2],[-1,-3,0],["a"]]
> return $x
> {noformat}
> interchange the execution sequence in the two threads such as:
> Thread 1 run: listAccessor.set(b, start, l);
> Thread 2 run: listAccessor.set(b, start, l);
> Thread 1 resume running.
> Thread 2 resume running.



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