XAMPP & ThreadStackSize

Problems with the Windows version of XAMPP, questions, comments, and anything related.

XAMPP & ThreadStackSize

Postby mbrett5062 » 10. December 2014 15:09

This is not a help request rather a suggestion open for discussion.

I have recently had an issue using a new module on Processwire CMS, processing of a rather large regex kept closing down the child process. After some investigation I came across this thread on stackoverflow.

This problem happens more often on Windows platform, because of smaller Apache's default stack size. There is 1 MB default stack size on Windows, unlike 8 MB on Unix/Linux platforms. It could be a reason, why some for example PHP scripts works properly on Linux, but cause crash of Apache on Windows.

Furthermore, the crash is silent (segmentation fault), there is no error message, Apache just stops responding and the child process is restarted. Browser gets no data and renders a blank page, so it's a bit difficult to decide what's wrong.

It's a common problem when working with long regular expressions in PHP.

There is one notice in Apache's error log only, which tells, that child process crashed:

Parent: child process exited with status 3221225725 -- Restarting

The best way to alter the Apache's stack size is using the ThreadStackSize directive in the Apache's configuration file. There is a description of the ThreadStackSize directive in Apache's documentation: http://httpd.apache.org/docs/2.2/mod/mpm_common.html#ThreadStackSize

So increase of the Apache's stack size on Windows might looks like this:

<IfModule mpm_winnt_module> ThreadStackSize 8388608 </IfModule>

These lines should be put in the Apache's configuration file. For simplicity, you could put it to httpd.conf. Or better (but not necessary), put it to httpd-mpm.conf file and in httpd.conf uncomment this line:

Include conf/extra/httpd-mpm.conf

It sets Apache's stack size to 8 MB, so it's the same as a default value on Linux.

And don't forget to restart Apache! :)

My suggestion is that ThreadStackSize change is made by default for Windows installation and httpd-mpm.conf is included by default for Windows.

Does anyone know of a reason this should not happen (Performance, other issues etc...)?
Posts: 1
Joined: 10. December 2014 14:47
Location: NJ/USA
Operating System: Windows 8 Enterprise 64-bit

Re: XAMPP & ThreadStackSize

Postby Altrea » 10. December 2014 15:27

mbrett5062 wrote:Does anyone know of a reason this should not happen (Performance, other issues etc...)?

http://httpd.apache.org/docs/2.4/en/mod/mpm_common.html#threadstacksize wrote:[...]
This type of adjustment is necessary only if the provider of the third-party module specifies that it is required, or if diagnosis of an Apache httpd crash indicates that the thread stack size was too small.

Most applications run very well with the default value of this setting, so i cannot recommend a general increase of this value
We don't provide any support via personal channels like PM, email, Skype, TeamViewer!

It's like porn for programmers 8)
User avatar
AF Moderator
Posts: 10642
Joined: 17. August 2009 13:05
XAMPP version: several
Operating System: Windows 10 Pro x64

Re: XAMPP & ThreadStackSize

Postby gsmith » 10. December 2014 20:50

Besides, Apache on Windows defaults to 64 threads, multiply that by 8MB and you can see why.
Posts: 268
Joined: 29. November 2013 18:04
Location: San Diego
XAMPP version: 0.0.0
Operating System: Win 10/2012R VS 14,15,16

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 92 guests