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

Support concurrency #83

Merged
merged 3 commits into from
Oct 17, 2020
Merged

Support concurrency #83

merged 3 commits into from
Oct 17, 2020

Conversation

Altai-man
Copy link
Member

So I did a bit of investigation for #63...

It seems find-headings is unsafe, so made it into a method and protected with monitor. ??? Problem is gone.

It seems Template::Mustache triggers some rakudo/moar(?) issue as well, as it refused to compile some pages (usually 5 plus-minus a couple from the whole documentation, always different ones) with a bogus error (self being null). So created a special loop catching issues doing some retries. It fixed the problem I saw. By the way, Cro::WebApp tested had no issues like this one and was on average 2.5x to 5x times faster, but to use it we need a smooth API at hand.

Did some crunching with 24 threads rendering whole documentation 100 times in a row. In three crunch sessions saw a moarvm bug once, which is, I suspect, known and so very obscure we probably don't want to deal with it here (I saw it reported in different places).

Otherwise, it became a lot more stable unless you really stresstest it, so I believe the ticket can be closed.

Stress-testing shows `find-headings` method triggered numerous errors when run in
a multi-threaded env, so convert it into a method (this introduced additional API point, but as rewriting
it into `given/where` would be far less efficient and private multi are not supported, this is the way
we go here) and make the whole class a monitor that fixes some bugs.
Additionally, add a simple workaround for internal bugs triggered by Template::Mustache rendering in
concurrent environment.

This deals with the most annoying cases of concurrent (ab)use of Pod::To::HTML module, surviving
rendering whole documentation for 100 times with 24 parallel workers.
Copy link

@JJ JJ left a comment

Choose a reason for hiding this comment

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

Please address the constant thing if you consider it necessary.

lib/Pod/To/HTML.pm6 Outdated Show resolved Hide resolved
@JJ JJ merged commit 1b694a1 into master Oct 17, 2020
@Altai-man Altai-man deleted the support-concurrency branch October 17, 2020 16:41
@JJ
Copy link

JJ commented Oct 26, 2020

I am thinking about reverting this PR, unless you give me a very good reason to do so. We don't know if it really addresses what it says it does, since it does not add new tests to the test set. And, on the other hand, it's built on top of another PR that is apparently causing some issues.

@Altai-man
Copy link
Member Author

I am thinking about reverting this PR, unless you give me a very good reason to do so

A (IMO) good reason not to revert it just now: reverting needs a time and a place. In general, it is not a solution. Some issues were solved by this PR but it introduced regressions.

A real solution: increase test coverage and fix regressions.
Result: you fixed old bugs and regressions are dealt with.

A temporary solution: revert.
Result: you get old bugs back.

AFAIK, we do not update docs automatically. Website is not broken right now. Website was not updated very often anyway. Is it impossible to wait until tomorrow for me to deal with regressions? We update website manually when possible, but it is absolutely very desperate to do it right now? We are not pressured to do a revert and can provide a real solution instead of messing with history. I don't get it.

@JJ
Copy link

JJ commented Oct 26, 2020

There was no good reason to merge it anyway, since it was not proved (by a test) it solved what it was supposed to solve.
Don't worry about docs now, I got a configuration that works but we really need to work out the issues in this module, starting with the very meager test suite.
I will still need a good test for this PR, though.

@Altai-man
Copy link
Member Author

There was no good reason to merge it anyway, since it was not proved (by a test) it solved what it was supposed to solve.

Tests do not prove there are no bugs at all. Especially it is very true for concurrency issues and this PR deals with a couple of those.
Just get someone to review the code. This PR uses common, proven techniques of dealing with concurrency issues.
This PR does result in an observable improvement in stresstesting I did, you can reproduce it if you want. Run the gist in the related ticket for 100 times using a lot of threads and see errors. Apply those patches and see how it renders without errors.

But such heavy stresstesting is not suitable for most users. Not everyone would want to render docs for 100 or for 1000 times using 24 or more threads. Possibly we can go with xt/ directory with such a test, but this is not in any case a reason to reject PR that does improve stability.

@JJ
Copy link

JJ commented Oct 26, 2020

I'm not rejecting it, it's already approved, and I did approve and merge it. xt tests are good enough, though.
Also, tests are not written for your code specifically. They are written to defend your code. If you don't write a test for this code proving that there are no errors, someone might come up in the future, wipe out this "monitor" thing and get back to the former error. So, please try and add these xt tests to the repo when you are done with the rest of the issues.

@JJ
Copy link

JJ commented Oct 26, 2020

Tests are going to protect your code also when you refactor the code for #80, which you will probably need to do, since #86 is critical.

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

Successfully merging this pull request may close these issues.

2 participants