We run a similar test using the resteasy `UndertowJaxrsServer` and the transaction reaper thread (`Thread implements Runnable`) is able to make JAX-RS invocations without the problem (of missing writers).

It also works fine if we deploy the coordinator using thorntail so it seems like it's an issue with the resteasy/wildfly integration.

On Fri, Sep 17, 2021 at 10:17 AM Manuel Finelli <jfinelli@redhat.com> wrote:
Hi all,

I would like to ask the community for help with an issue we are experiencing running the Long Running Action module of Narayana in WildFly. Going straight to the point, we are experiencing a funny issue when a thread from ForkJoin pool is used to manage expired LRA transactions: in the `try/catch` block at [1], the following exception is thrown:

```javax.ws.rs.ProcessingException: RESTEASY004655: Unable to invoke request: javax.ws.rs.ProcessingException: RESTEASY003215: could not find writer for content-type text/plain type: java.lang.String```

We arrive at that `try/catch` block from this async call [2]. It seems that the request from the coordinator to the participant [3] fails because there is no provider for "content-type text/plain type: java.lang.String" (which sounds strange as this should be one of the basic providers).

We see this exception when the Narayana LRA WAR is deployed to WildFly and also when the LRA coordinator is provided as a feature pack. Also, the same exception is thrown when the TransactionReaper thread (a standard Thread implementing Runnable) is employed to handle expired LRA transactions (we would prefer to use TransactionReaper since we also employ it in the JTA module to manage transaction timeouts).
We know that the best practise would be to use a managed thread pool but we want to keep Narayana LRA independent from any container.

To temporarily overcome this issue, we used a dedicated ThreadPool

```private static final BlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(100);
private static final ExecutorService EXECUTOR_SERVICE = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MICROSECONDS, queue);```

in [2], i.e.

```CompletableFuture.supplyAsync(this::cancelLRA, EXECUTOR_SERVICE);```

This fixes the issue...but to us it looks more like a workaround rather than a solution. This workaround is     going to be merged (again) in our current main branch (PR 1907 [4]).

Some extra info about this issue:
* Narayana uses RESTEasy 3.9.1
* I have tried to use RESTEasy 4.7.1 but with no luck
* According with James (hopefully, I have reported this well), ResteasyContext map is empty and the reason does not seem to be related to the use of a non-managed thread

[1]: https://github.com/jbosstm/narayana/blob/44cb48e1d4d93045a138f182153cce6e65276ed0/rts/lra/coordinator/src/main/java/io/narayana/lra/coordinator/domain/model/LRAParticipantRecord.java#L328-L366
[2]: https://github.com/jbosstm/narayana/blob/44cb48e1d4d93045a138f182153cce6e65276ed0/rts/lra/coordinator/src/main/java/io/narayana/lra/coordinator/domain/model/LongRunningAction.java#L942
[3]: https://github.com/jbosstm/narayana/blob/44cb48e1d4d93045a138f182153cce6e65276ed0/rts/lra/coordinator/src/main/java/io/narayana/lra/coordinator/domain/model/LRAParticipantRecord.java#L331
[4]: https://github.com/jbosstm/narayana/pull/1907
_______________________________________________
wildfly-dev mailing list -- wildfly-dev@lists.jboss.org
To unsubscribe send an email to wildfly-dev-leave@lists.jboss.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s


--
Michael Musgrove

JBoss, by Red Hat
Registered Address: Red Hat Ltd, 6700 Cork Airport Business Park, Kinsale Road, Co. Cork.
Registered in the Companies Registration Office, Parnell House, 14 Parnell Square, Dublin 1, Ireland, No.304873
Directors:Michael Cunningham (USA), Vicky Wiseman (USA), Michael O'Neill, Keith Phelan, Matt Parson (USA)