-
Notifications
You must be signed in to change notification settings - Fork 887
Closed
Description
When I try to convert a small markdown content into HTML with the below code,
html = MD.reset().convert(para)
it works without any problem. But when I make swarm multiple concurrent requests with that content I get the following three types of error which occurs randomly. Most of the time a single type of error would occur.
File "/Users/arjun/converter/util.py", line 101, in markdown_to_text
html = MD.reset().convert(para)
File "/Users/arjun/environments/mdtest/lib/python3.6/site-packages/markdown/core.py", line 295, in convert
output = pp.run(output)
File "/Users/arjun/environments/mdtest/lib/python3.6/site-packages/markdown/postprocessors.py", line 75, in run
html = self.md.htmlStash.rawHtmlBlocks[i]
IndexError: list index out of range```
File "/Users/arjun/converter/util.py", line 101, in markdown_to_text
html = MD.reset().convert(para)
File "/Users/arjun/environments/mdtest/lib/python3.6/site-packages/markdown/core.py", line 272, in convert
newRoot = treeprocessor.run(root)
File "/Users/arjun/environments/mdtest/lib/python3.6/site-packages/markdown/treeprocessors.py", line 378, in run
self.ancestors.pop()
IndexError: pop from empty list
File "/Users/arjun/converter/util.py", line 101, in markdown_to_text
html = MD.reset().convert(para)
File "/Users/arjun/environments/mdtest/lib/python3.6/site-packages/markdown/core.py", line 272, in convert
newRoot = treeprocessor.run(root)
File "/Users/arjun/environments/mdtest/lib/python3.6/site-packages/markdown/treeprocessors.py", line 372, in run
self.__handleInline(text), child
File "/Users/arjun/environments/mdtest/lib/python3.6/site-packages/markdown/treeprocessors.py", line 215, in __processPlaceholders
for child in [node] + list(node):
TypeError: 'NoneType' object is not iterable
And the dummy content I passed as input is,
**To edit a record:**
1. Click the **Red** Button.
2. In the _main_ page, click the **Home** tab in the lower-left corner.
3. In the _Home_ page, select an record to view its details.
4. In the _details_ page, click the **Save& Data** icon ( {: style="width: 13px; vertical-align: sub; max-width: 100%" height width } ) from the floating widgets on the left of the screen.
5. Under _Save & Data Information_ section, click **New Data**.
It was happening randomly for different data. So reproduce the issue with a small content I took this. Generally when it happened the number of requests were low. But to reproduce the issue for this content I had to increase the request count as 200req/sec, and I could reproduce it after 20000, successfully completed requests
My suggestions are (based on the issue order)
- Iterating based on the length of self.md.htmlStash.rawHtmlBlocks[i]
- Checking the length before popping
- Adding null checks
Metadata
Metadata
Assignees
Labels
No labels