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

Adding a linkifier can cause sending messages to timeout. #12410

Open
davidtwco opened this issue May 27, 2019 · 1 comment
Open

Adding a linkifier can cause sending messages to timeout. #12410

davidtwco opened this issue May 27, 2019 · 1 comment

Comments

@davidtwco
Copy link
Contributor

I've found that when creating two linkifiers, one of which is a subset of the other, then sending a message with the "more restrictive" linkifier will cause Zulip to timeout when rendering the message.

For example, given this linkifier that matches any JIRA ticket - (?P<id>[A-Z]+-[0-9]+) (URL isn't important) - and this linkifier which matches a specific JIRA project (which could be on a different instance and thus isn't handled correctly by the first linkifier) - FOO-(?P<id>[0-9]+) - then when sending a message like FOO-3, Zulip will timeout when rendering the message.

Logger root, from module zerver.lib.bugdown line 2211:
Error generated by Anonymous user (not logged in) on chat deployment

Traceback (most recent call last):
  File "/home/zulip/deployments/2019-05-04-17-26-36/zerver/lib/bugdown/__init__.py", line 2195, in do_convert
    rendered_content = timeout(5, _md_engine.convert, content)
  File "/home/zulip/deployments/2019-05-04-17-26-36/zerver/lib/timeout.py", line 83, in timeout
    raise TimeoutExpired
zerver.lib.timeout.TimeoutExpired: Function call timed out.


Deployed code:
- ZULIP_VERSION: 2.0.3
- version: 2.0.3


Request info: none
@timabbott
Copy link
Sponsor Member

Yes, overlapping patterns are not supported. My guess is you're causing an infinite loop in the markdown processor, which is being caught by our timeout for detecting that. I'm not sure there's an easy way for us to handle this generically, but generally the advice is to use mutually exclusive patterns (e.g. require a # before the ID in the first pattern or whatever).

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

No branches or pull requests

3 participants