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

mlm_client_set_consumer () with pattern == '*' breaks the stream #217

Open
karolhrdina opened this issue Dec 5, 2016 · 2 comments
Open

Comments

@karolhrdina
Copy link
Contributor

karolhrdina commented Dec 5, 2016

Assigning character '*' as regex pattern to mlm_client_set_consumer () breaks the stream, to which it is subscribing. Not even the already subscribed clients receive nothing. This does happen with character '*' only (this is the only one we know about SO FAR). A bad regular expression, i.e. '[' does not break it at all."

How to reproduce:
Code here: https://gist.github.com/karolhrdina/0fefb5266b57467c0c6e3c17125656f6

Note: There is also PR (#216) pending, but for some reason it breaks some Travis tests.

There will be 2 streams created (FIRST, WORLD); one producer per stream, publishing a random number each half a second. For stream FIRST one consumer is created. For stream WORLD two consumers are created, then we wait 5 seconds to show this works, then we create third consumer with pattern '*' and the stream WORLD gets broken.

Tested against latest upstream master (at that time): commit a0f22db

@karolhrdina
Copy link
Contributor Author

Ok, it is confirmed that the root cause if this issue is in zrex_t in czmq.
zrex_new ('*') does not return NULL, zrex_valid () returns true but subsequent zrex_match () hangs.

Further investigation showed that underlying SLRE in czmq.git/src/foreign/slre/ is the cause of this error,
i.e.:

slre_compile (&slre, "*"); returns 1
slre_match (&slre, argv [1], strlen (argv [1]), captures); hangs orever (infinite loop/reccursion).

Note: When resolved in czmq, please close this issue as well
Action: I will create an issue with CZMQ.git

@jimklimov
Copy link
Member

jimklimov commented May 27, 2019

Was pattern * supposed to mean a shell wildcard, while the backend expects regular expressions?
Probably the proper fix would be to require consumers to specify real regexes, though a convenience workaround can be to map a specific "*" argument into a ".*" regex (or "^.*$" would the parsing engine require, as some do, or "" as should match anything as well)?

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

No branches or pull requests

2 participants