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

plugin_util: use thread-local Markdown converter #3491

Merged
merged 1 commit into from
Apr 7, 2020

Conversation

wchargin
Copy link
Contributor

@wchargin wchargin commented Apr 6, 2020

Summary:
In #3348, we centralized a shared Markdown converter rather than
creating a new one for each call. But this had the effect of sharing the
converter across threads, which is not supported, as the API docs
helpfully note
. This commit splits the globally shared converter
into separate thread-local converters.

Test Plan:
Prior to this change, some requests would 500 due to internal errors in
the Markdown converter:

  File ".../markdown/treeprocessors.py", line 187, in __processPlaceholders
    for child in [node] + list(node):
TypeError: 'NoneType' object is not iterable

This was always nondeterministic, but I haven’t been able to reproduce
it with this patch, even hammering the dashboard with a bunch of Chrome
tabs or curl requests.

wchargin-branch: threadlocal-markdown-converter

Summary:
In #3348, we centralized a shared Markdown converter rather than
creating a new one for each call. But this had the effect of sharing the
converter across threads, which is not supported, as the [API docs
helpfully note][1]. This commit splits the globally shared converter
into separate thread-local converters.

[1]: https://python-markdown.github.io/reference/#Markdown

Test Plan:
Prior to this change, some requests would 500 due to internal errors in
the Markdown converter:

```
  File ".../markdown/treeprocessors.py", line 187, in __processPlaceholders
    for child in [node] + list(node):
TypeError: 'NoneType' object is not iterable
```

This was always nondeterministic, but I haven’t been able to reproduce
it with this patch, even hammering the dashboard with a bunch of Chrome
tabs or `curl` requests.

wchargin-branch: threadlocal-markdown-converter
Copy link
Contributor

@psybuzz psybuzz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@wchargin wchargin merged commit be82cf2 into master Apr 7, 2020
@wchargin wchargin deleted the wchargin-threadlocal-markdown-converter branch April 7, 2020 21:34
@nfelt nfelt mentioned this pull request Apr 14, 2020
bileschi pushed a commit to bileschi/tensorboard that referenced this pull request Apr 15, 2020
Summary:
In tensorflow#3348, we centralized a shared Markdown converter rather than
creating a new one for each call. But this had the effect of sharing the
converter across threads, which is not supported, as the [API docs
helpfully note][1]. This commit splits the globally shared converter
into separate thread-local converters.

[1]: https://python-markdown.github.io/reference/#Markdown

Test Plan:
Prior to this change, some requests would 500 due to internal errors in
the Markdown converter:

```
  File ".../markdown/treeprocessors.py", line 187, in __processPlaceholders
    for child in [node] + list(node):
TypeError: 'NoneType' object is not iterable
```

This was always nondeterministic, but I haven’t been able to reproduce
it with this patch, even hammering the dashboard with a bunch of Chrome
tabs or `curl` requests.

wchargin-branch: threadlocal-markdown-converter
bileschi pushed a commit that referenced this pull request Apr 15, 2020
Summary:
In #3348, we centralized a shared Markdown converter rather than
creating a new one for each call. But this had the effect of sharing the
converter across threads, which is not supported, as the [API docs
helpfully note][1]. This commit splits the globally shared converter
into separate thread-local converters.

[1]: https://python-markdown.github.io/reference/#Markdown

Test Plan:
Prior to this change, some requests would 500 due to internal errors in
the Markdown converter:

```
  File ".../markdown/treeprocessors.py", line 187, in __processPlaceholders
    for child in [node] + list(node):
TypeError: 'NoneType' object is not iterable
```

This was always nondeterministic, but I haven’t been able to reproduce
it with this patch, even hammering the dashboard with a bunch of Chrome
tabs or `curl` requests.

wchargin-branch: threadlocal-markdown-converter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants