php-markdown icon indicating copy to clipboard operation
php-markdown copied to clipboard

Files with a lot of HTML don't load in local environment (v1.4.0)

Open florentpoujol opened this issue 11 years ago • 6 comments

Hey

In my local environment (Wamp server on win 7 and PHP markdown v1.4.0), I can't display a markdown file which contains about 2000 lines or more of HTML. The page don't load and display after only a few seconds "The connection was re initialized" on Firefox or "Inaccessible page" in Chrome.

It works OK when not in local environment with v1.4.0. It works OK in local with v1.0.1o, but it doesn't work any more (in local) as soon as v1.0.2.

My question here is : why does this happens ? And how to fix/workaround that, if possible ?

Thanks !

florentpoujol avatar Feb 09 '14 18:02 florentpoujol

Can't you check what it says in the server logs (for apache)?

I suspect an issue with regex recursion would overstep some limit, but I'm not sure. What is your pcre.backtrack_limit setting in php.ini? Maybe this is related to fdd003e0d; you could try reverting that commit and see what it does.

michelf avatar Feb 09 '14 18:02 michelf

Hey thanks for your reply !

When I try and fail to load the page, the apache error log shows :

[Fri Feb 14 16:26:07 2014] [notice] Parent: child process exited with status 255 -- Restarting. [Fri Feb 14 16:26:08 2014] [notice] Apache/2.2.22 (Win32) mod_ssl/2.2.22 OpenSSL/0.9.8u PHP/5.3.13 configured -- resuming normal operations [Fri Feb 14 16:26:08 2014] [notice] Server built: May 13 2012 13:32:42 [Fri Feb 14 16:26:08 2014] [notice] Parent: Created child process 1248 [Fri Feb 14 16:26:08 2014] [warn] Init: Session Cache is not configured [hint: SSLSessionCache] [Fri Feb 14 16:26:09 2014] [notice] Child 1248: Child process is running [Fri Feb 14 16:26:09 2014] [notice] Child 1248: Acquired the start mutex. [Fri Feb 14 16:26:09 2014] [notice] Child 1248: Starting 64 worker threads. [Fri Feb 14 16:26:09 2014] [notice] Child 1248: Starting thread to listen on port 80. [Fri Feb 14 16:26:09 2014] [notice] Child 1248: Starting thread to listen on port 80.

The pcre.backtrack_limit is set at 1 000 000. The pcre.recursion_limit is set at 100 000. Increasing or lowering these values has no effect.

Reverting the changes made in the commit you referenced has no effect either. :(

But it's definitely a question of quantity of HTML code in the file. It especially doesn't like when too much code is inside the same element.

The two files for which it happens are : https://raw.github.com/florentpoujol/DaneelDocumentation/develop/docs/files/core/functionreference.md https://github.com/florentpoujol/DaneelDocumentation/blob/develop/docs/files/modules/gui.md (HTML at the end)

florentpoujol avatar Feb 14 '14 16:02 florentpoujol

I'm not really sure what to make of this. Isn't there any PHP-related errors before the "child process exited with status 255" line? Also, how much time does it take between the request and the exited process, in other words, could it be a timeout of some sort?

michelf avatar Feb 16 '14 21:02 michelf

I tried both files and couldn't reproduce the error on Linux + Mac. Here's the setup I used: Apache 2.2, PHP 5.3 + 5.4, PHP Markdown 1.4.0.

markseuffert avatar Feb 21 '14 11:02 markseuffert

might be a good idea to try xdebug . see if you can narrow it down with that.

ghost avatar Jul 24 '14 07:07 ghost

I just encountered a similar issue with a really large <ul>. The parse broke on line #554, character 19,998.

However the same markdown did not break on your dingus demo.

When I changed my approach to the markup (altering Level-1 <li>s to <H2>s the problem went away. A hacky fix but there was only one record with this amount of MD in a single element.

raveling avatar Jun 10 '19 03:06 raveling