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

Growing number of broadcaster threads #716

Closed
nite23 opened this issue Oct 29, 2012 · 5 comments
Closed

Growing number of broadcaster threads #716

nite23 opened this issue Oct 29, 2012 · 5 comments
Labels

Comments

@nite23
Copy link
Contributor

nite23 commented Oct 29, 2012

I create a new broadcaster with a unique ID for every new client. I track clients by saving a cookie with broadcaster ID.
I programmatically set up shared thread pools for every new broadcaster, as per the wiki guide.

broadcasterLifeCyclePolicy is set to IDLE_DESTROY in web.xml, with idle time 35000 ms.

The problem is, as new clients connect, there is constantly a growing number of threads that never get removed, even when clients disconnect and idle timeout expires.

Thread dump shows hundreds of threads with names like pool-21426-thread-1 that are waiting indefinitely.

I use Jersey, long-polling transport, glassfish 3.1.2.2, latest snapshot of atmosphere.

There was no issue with atmosphere 1.0.2

@jfarcand
Copy link
Member

@nite23 Which version are you using to reproduce the issue? Also please attach the thread dump if you can. Thanks

@jfarcand
Copy link
Member

@nite23 To be more specific, you use 1.1.0-SNAPSHOT or 1.0.3-SNAPSHOT?

@nite23
Copy link
Contributor Author

nite23 commented Oct 29, 2012

I use 1.1.0-SNAPSHOT

here's the dump: http://files.internetplus.cz/dump.txt

jfarcand added a commit that referenced this issue Oct 29, 2012
@jfarcand
Copy link
Member

OK, I fail to reproduce this issue using 1.1-SNAPSHOT and this test case:

    @Test
    public void testBroadcasterEmptyDestroy() throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        final AtomicReference<Boolean> deleted = new AtomicReference<Boolean>();
        BroadcasterListener l = new BroadcasterListener() {
            @Override
            public void onPostCreate(Broadcaster b) {
            }

            @Override
            public void onComplete(Broadcaster b) {
            }

            @Override
            public void onPreDestroy(Broadcaster b) {
                deleted.set(Boolean.TRUE);
                latch.countDown();
            }
        };
        BroadcasterFactory.getDefault().addBroadcasterListener(l).get("/b1")
                .setBroadcasterLifeCyclePolicy(new BroadcasterLifeCyclePolicy.Builder()
                        .policy(BroadcasterLifeCyclePolicy.ATMOSPHERE_RESOURCE_POLICY.IDLE_DESTROY)
                .idleTime(5, TimeUnit.SECONDS).build());

        latch.await(10, TimeUnit.SECONDS);

        assertTrue(deleted.get());
    }

@jfarcand
Copy link
Member

jfarcand commented Nov 1, 2012

Fixed by #717

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants