Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Websockets next incompatible with undertow extension when using @SessionScoped #46548

Closed
Malandril opened this issue Feb 27, 2025 · 4 comments · Fixed by #46561
Closed

Websockets next incompatible with undertow extension when using @SessionScoped #46548

Malandril opened this issue Feb 27, 2025 · 4 comments · Fixed by #46561
Assignees
Labels
area/websockets kind/bug Something isn't working
Milestone

Comments

@Malandril
Copy link
Contributor

Malandril commented Feb 27, 2025

Describe the bug

When declaring a websocket next endpoint with @SessionScoped and the undertow extension is present quarkus fails with

jakarta.enterprise.context.ContextNotActiveException: SessionScoped context was not active when trying to obtain a bean instance for a client proxy of CLASS bean [class=foo.WebsocketController, id=lNM_wkJwmYkOEPs73Mdy8AVQkns]
        - @SessionScoped is not supported by default. However, a Quarkus extension implementing session context can be used to enable this functionality (such as Undertow extension).
        at io.quarkus.arc.impl.ClientProxies.notActive(ClientProxies.java:76)
        at io.quarkus.arc.impl.ClientProxies.getSingleContextDelegate(ClientProxies.java:32)
        at foo.WebsocketController_ClientProxy.arc$delegate(Unknown Source)
        at foo.WebsocketController_ClientProxy.open(Unknown Source)
        at foo.WebsocketController_WebSocketServerEndpoint.doOnOpen(Unknown Source)
        at io.quarkus.websockets.next.runtime.WebSocketEndpointBase$4.call(WebSocketEndpointBase.java:167)
        at io.quarkus.websockets.next.runtime.WebSocketEndpointBase$4.call(WebSocketEndpointBase.java:161)
        at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$4(ContextImpl.java:192)
        at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:270)
        at io.vertx.core.impl.ContextImpl$1.execute(ContextImpl.java:221)
        at io.vertx.core.impl.WorkerTask.run(WorkerTask.java:56)
        at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2675)
        at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2654)
        at org.jboss.threads.EnhancedQueueExecutor.runThreadBody(EnhancedQueueExecutor.java:1627)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1594)
        at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
        at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Thread.java:1583)

Expected behavior

Adding the Undertow extension should not make the websocket fail if it is @SessionScoped

Actual behavior

No response

How to Reproduce?

Simply having the undertow extension and websockets-next and the following is enough

@SessionScoped
@WebSocket(path = "/ws")
public class WebsocketController {
    @OnOpen
    void open(){
        Log.info("Connected");
    }
}

Reproducer

  1. Clone the reproducer https://github.com/Malandril/quarkus-bug-websocket-undertow
  2. run quarkus dev
  3. try to connect using websockets to ws://localhost:8080/ws

Output of uname -a or ver

linux

Output of java -version

21

Quarkus version or git rev

3.19.1

Build tool (ie. output of mvnw --version or gradlew --version)

gradle

Additional information

This happens since quarkus 3.18

@Malandril Malandril added the kind/bug Something isn't working label Feb 27, 2025
@melloware
Copy link
Contributor

melloware commented Feb 27, 2025

@Malandril this is similar to the issue we reported here: quarkusio/quarkus-http#168

@Malandril
Copy link
Contributor Author

@melloware I'm not sure as it seems more like regression, after checking it happens only since after quarkus 3.17.8 with the 3.18

@melloware
Copy link
Contributor

Ahh ok so it was working before.

@geoand
Copy link
Contributor

geoand commented Feb 28, 2025

cc @mkouba

@mkouba mkouba self-assigned this Feb 28, 2025
mkouba added a commit to mkouba/quarkus that referenced this issue Feb 28, 2025
- the problem occurs when quarkus-websockets-next and quarkus-undertow
extensions are used at the same time
- fixes quarkusio#46548
mkouba added a commit to mkouba/quarkus that referenced this issue Feb 28, 2025
- the problem occurs when quarkus-websockets-next and quarkus-undertow
extensions are used at the same time
- fixes quarkusio#46548
@quarkus-bot quarkus-bot bot added this to the 3.21 - main milestone Feb 28, 2025
@gsmet gsmet modified the milestones: 3.21 - main, 3.19.2 Mar 4, 2025
gsmet pushed a commit to gsmet/quarkus that referenced this issue Mar 4, 2025
- the problem occurs when quarkus-websockets-next and quarkus-undertow
extensions are used at the same time
- fixes quarkusio#46548

(cherry picked from commit 8e3211c)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/websockets kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants