Large post body are causing the bySimilarity to hang, and posts to crash
It appears that similarity search is causing the editor to hang. When I have a large post body that goes over the size of a http header I get this in the js console :
OPTIONS https://api.utopian.io/api/posts/?limit=5&skip=0§ion=all&sortBy=created…678901234567890123456789012345678901234567890%60%60%60%0A%0A%0A&reset=true net::ERR_EMPTY_RESPONSE
c._end @ client.js:770
c.end @ client.js:674
(anonymous) @ request-base.js:238
r.then @ request-base.js:237
p @ api.js:20
(anonymous) @ api.js:87
(anonymous) @ index.js:37
(anonymous) @ errorMiddleware.js:18
dispatch @ applyMiddleware.js:35
(anonymous) @ contributions.js:19
(anonymous) @ index.js:11
(anonymous) @ api.js:46
(anonymous) @ index.js:37
(anonymous) @ errorMiddleware.js:18
(anonymous) @ bindActionCreators.js:3
(anonymous) @ SimilarPosts.js:35
r @ debounce.js:95
d @ debounce.js:142
h @ debounce.js:130
SimilarPosts.js:46 Uncaught (in promise) TypeError: Cannot read property 'results' of undefined
at SimilarPosts.js:46
Looking at the network trace, I see the problem
curl 'https://api.utopian.io/api/posts/?limit=5&skip=0§ion=all&sortBy=created&type=bug-hunting&bySimilarity=Large%20words%20are%20causing%20the%20editor%20to%20hang%0AIt%20appears%20that%20something%20is%20causing%20the%20editor%20to%20hang.%0A%0A1234567... .hug body truncated.. 6789012345678901234567890&reset=true' -X OPTIONS -H 'Access-Control-Request-Method: GET' -H 'Origin: https://utopian.io' -H 'Referer: https://utopian.io/write?draft=1603aee6dc2' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.98 Safari/537.36' -H 'Access-Control-Request-Headers: session' --compressed
Then saving also crashes the server
POST https://api.utopian.io/api/sc2/broadcast 500 (Internal Server Error)
editorActions.js:146 Error: Internal Server Error
at c.<anonymous> (client.js:423)
at c.r.emit (index.js:133)
at XMLHttpRequest.t.onreadystatechange (client.js:703)
Posted on Utopian.io - Rewarding Open Source Contributors
Hey @h4ck3rm1k3st33m I am @utopian-io. I have just upvoted you!
Achievements
Suggestions
Get Noticed!
Community-Driven Witness!
I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!
Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Can you please provide a issue/bug/ticket number that I can track the resolution of?
I wrote about this here https://utopian.io/utopian-io/@h4ck3rm1k3st33m/bug-hunting-posts-in-utopian-need-a-issue
An issue was filed on GitHub: https://github.com/utopian-io/utopian.io/issues/201
But you are right about the UI. I think a simple integration of the GitHub issues into the Utopian UI would be cool.
Your contribution cannot be approved yet. Could you please edit the title to say "Large post body..." too? You used the tag #max-http-header-size. A short explicit note in your post that this is probably the problem, would also be great!
You may edit your post here, as shown below:
You can contact us on Discord.
[utopian-moderator]