pulsar-client-node icon indicating copy to clipboard operation
pulsar-client-node copied to clipboard

more than 3 topics blocks async operations

Open steelone opened this issue 5 years ago • 8 comments

If we have more than 3 active topics Pulsar blocks all async operations such as readdir, readFile, http.get, etc. on NodeJS So, I cannot read even static files, do HTTP requests, etc.

I prepared for you a pure NodeJS example with "Pulsar client.subscribe" and 4 topics here

steelone avatar Oct 20 '20 10:10 steelone

@nkurihar @maskit Can anyone of you take a look at this issue?

sijie avatar Oct 22 '20 18:10 sijie

@steelone i have not succeeded to run your example yet, but the issue may be caused by the default number of worker threads being 4. can you please try setting an environment variable UV_THREADPOOL_SIZE to a bigger number?

kimula avatar Oct 26 '20 06:10 kimula

@cimura what exactly the obstacle for you to run my test project? It starts well on my all computers.

steelone avatar Oct 31 '20 17:10 steelone

@cimura and I tested UV_THREADPOOL_SIZE. It doesn't help

steelone avatar Oct 31 '20 17:10 steelone

image it is master branch. where you see that blocked readdir like an example. I think it is a serious problem which you should fix as soon as possible. We even decided to use workers for avoiding this problem.

steelone avatar Oct 31 '20 17:10 steelone

@steelone i succeeded to run your example and reproduce the problem (it was due to not your example but my environment). i think that using listener instead of while loop makes it work. like:

const consumer = await client.subscribe({
    topic,
    subscription: 'sub1',
    subscriptionType,
    listener: (msg, consumer) => {
        try {
            consumer.acknowledge(msg);
            onMessage(msg.getData().toString());
        } catch (e) {
            consumer.close();
            onError(e);
        }
    }
});

kimula avatar Nov 02 '20 06:11 kimula

This issue is still relevant for me. Maybe anyone knows the reason?

Liapin avatar Oct 26 '21 13:10 Liapin

@Liapin As far as I confirmed, the example mentioned above did not reproduce the problem. Could you tell me your environment (e.g. OS, pulsar library version, node version) or a specific situation where it occurs?

kimula avatar Oct 28 '21 07:10 kimula