Windows apache thread stack size

Как мне увеличить размер стека для Apache, работающего под Windows 7?

Я думаю, что получаю переполнение стека при запуске приложения cakePHP на сервере Apache под Windows 7.

1 ответ

Эта проблема чаще возникает на платформе Windows из-за меньшего размера стека Apache по умолчанию. В Windows размер стека по умолчанию составляет 1 МБ, в отличие от 8 МБ на платформах Unix/Linux. Это может быть причиной того, почему некоторые, например, PHP-скрипты работают правильно в Linux, но вызывают сбой Apache в Windows.

Кроме того, сбой происходит тихо (ошибка сегментации), сообщения об ошибках нет, Apache просто перестает отвечать, а дочерний процесс перезапускается. Браузер не получает данных и отображает пустую страницу, поэтому немного сложно решить, что же не так.

Это распространенная проблема при работе с длинными регулярными выражениями в PHP.

В журнале ошибок Apache есть только одно сообщение о том, что дочерний процесс завершился сбоем:

Лучший способ изменить размер стека Apache — использовать директиву ThreadStackSize в файле конфигурации Apache. Описание документации ThreadStackSize приведено в документации Apache: http://httpd.apache.org/docs/2.2/mod/mpm_common.html.

Таким образом, увеличение размера стека Apache в Windows может выглядеть так:

Эти строки должны быть помещены в файл конфигурации Apache. Для простоты вы можете поместить его в httpd.conf. Или лучше (но не обязательно), поместите его в файл httpd-mpm.conf и в httpd.conf раскомментируйте эту строку:

Он устанавливает размер стека Apache равным 8 МБ, поэтому он равен значению по умолчанию в Linux.

И не забудьте перезапустить Apache! 🙂

TYPO3 Core

Development of TYPO3 CMS

Custom queries

Bug #71858

Windows apache thread stack size not taken into account ?!

Description

when installing I get since quite a few releases the following hint during installation and no also in the status report after installation:

Windows apache thread stack size

This current value cannot be checked by the system, so please ignore this warning if it is already taken care of: Fluid uses complex regular expressions which require a lot of stack space during the first processing. On Windows the default stack size for Apache is a lot smaller than on UNIX. You can increase the size to 8MB (default on UNIX) by adding the following configuration to httpd.conf and restarting Apache afterwards:

Читайте также:  Драйвера elan smart pad windows 10

ThreadStackSize 8388608

I am sure that I have added that to the conf file regardless where I put it there right in the beginning or in the end it is either not consider from apache or typo3 does not recognize it.

Updated by Wouter Wolters over 5 years ago

  • Status changed from New to Closed

We show this warning because, as you can read in the text, the value can not be checked by TYPO3 on Windows.
To make system administrators aware of the problems this warning is shown. Please ignore the warning if it is already taken care of.

Updated by Eckard Gehrke over 5 years ago

Hi,
is it possible to configure it in a conf file not to show the message any more.
In 7.6 when I log on I now get an «Important notice, one or more problems..» (which is good) but it goes to red and doesn’t tell me directly that it is this special error that I can ignore.
I have to go to the «status report», and there only a warning in System environment check:
The system environment check returned warnings. Those warnings might have a negative effect on the functionality and stability of your TYPO3 CMS instance. Please check the install tool «System environment» for all details.
Only there (after unlocking the install tool) I see then the Windows apache thread stack size hint, whihc I do already now.

Actually I told the system already during install «Yes I now what I am doing continue»

Updated by shaun Powell about 5 years ago

I’ve been seeing this warning message continuously since upgrade to 7.0 as well. It is annoying and could be hiding other installation problems.
Is it possible to add a conditional to \typo3_src-7.6.2\typo3\sysext\install\Classes\SystemEnvironment\Check.php to look for an ignore flag in the $Globals[‘TYPO3_CONF_VARS’]user array ?
For example, if Server apache and OS windows and exists flagIgnoreThread and flagIgnoreThread == true

Updated by Riccardo De Contardi about 5 years ago

I’ve seen it even on 6.2.x (using XAMPP and WAMP environments)

Настройка веб-сервера Apache

Apache — самый используемый веб-сервер с MediaWiki.

Contents

Модули

PHP как модуль Apache

MediaWiki написана для использования PHP в качестве модуля Apache. PHP настроен как модуль, если ваш сайт начинается с URL такого вида:

Вы можете проверить какая конфигурация и версия PHP используется, с помощью просмотра вашей вики Special:Version страницы, или с помощью phpinfo().

RedHat/Fedora-based Linux
Debian-based Linux

Установка apache2 php5 модуля:

В Ubuntu 16.04.2 LTS

Включение apache2 php5 модуля:

PHP как CGI

Если PHP работает как CGI, у вас будут «некрасивые» URL-адреса по умолчанию, но вы все еще можете реализовать короткие URL-адреса..

CGIWrap

Если у вас есть свой ​​собственный сервер с работающим Apache и работающим PHP как CGI, вы можете установить CGIWrap. Этот инструмент позволяет запускать сервер Apache от имени другого пользователя для CGI.

Читайте также:  Почему запускается internet explorer при включении компьютера windows 10

Таким образом, вы можете создать нового пользователя для страниц MediaWiki. Установка CGIWrap выходит за рамки этого документа, тем более, что вы должны скомпилировать его на собственном сервере. Однако, в качестве краткого руководства, можете следовать следующим правилам:

  • Создайте Wikimedia пользователя
  • Have a cgi-bin folder, containing CGIWrap (example in /home/myuser/cgi-bin). Once everything is configured, keep only cgiwrap, move the debug versions to another folder if you ever need it. Your cgiwrap file should be accessible only to Apache (chown and chmod accordingly).
  • Внутри папки cgi-bin создайте символьную ссылку на root-каталог Wikimedia.
  • В вашем .htaccess файле wiki добавьте следующие определения:
  • Наконец, смените владельца (chown) и права доступа (chmod) у всех .php файлов в вашей папке Wikimedia так, чтобы они были доступны только пользователю wikiuser.

The files will be accessible as usual. You do not need to specify in your path any cgi-bin, as this is transparently taken care of for you.

I strongly suggest you start out with /cgi-bin/cgiwrapd/. as your php-wrapper, as it will precisely show what is currently working. I also strongly suggest you do not delete your CGIWrap source folder until everything works perfectly as this is a real trial and error process, taking a long time. However, it’s all worth your time as your MediaWiki will be run in its own separate process, in its own uid, without being able to interfere any other uid. Inverse is also true, except for root, that can read anything anywhere.

mod_alias / mod_rewrite

The recommended method of beautifying URLs involves mod_alias. Other methods use mod_rewrite instead.

mod_security

ModSecurity has been known to cause problems with MediaWiki. If you get errors seemingly at random, check your error log to see whether it is causing problems.

VisualEditor and Subpages

In order to prevent errors contacting the Parsoid server, AllowEncodedSlashes NoDecode must be added to the wiki’s VirtualHost config block (or to the general server config if VirutalHosts are not used).

What is thread stack size option(-Xss) given to jvm? Why does it have a limit of atleast 68k in a windows pc?

I have seen JVM option -Xss — What does it do exactly? this link, but my question is how is this option useful.

Because, if we set a very minimum limit to the -Xss value, maybe the threads are not going to work properly as it may throw stackOverflow error most of the times.

Why is there a 64k limit at least for this value?
How i got this 64k limit is when i was trying to configure the runtime vm options on the IntelliJ iDE, I tried to give some thing like 10k and it popped up this error stating it needs at least 64k for thread stack size.

Another question is that, how to find the default thread stack size of my jvm running in my embedded device from a java program?

Читайте также:  Embedded windows intel atom

1 Answer 1

-Xss allows to configure Java thread stack size according to application needs:

  • larger stack size is for an application that uses recursive algorithms or otherwise deep method calls;
  • smaller stack size is for an application that runs thousands of threads — you may want to save memory occupied by thread stacks.

Bear in mind that HotSpot JVM also utilizes the same Java thread stack for the native methods and JVM runtime calls (e.g. class loading). This means Java thread stack is used not only for Java methods, but JVM should reserve some stack pages for its own operation as well.

The minimum required stack size is calculated by the formula:

  • StackYellowPages and StackRedPages are required to detect and handle StackOverflowError;
  • StackShadowPages are reserved for native methods;
  • 2*4 (32-bit JVM) or 2*8 (64-bit JVM) is for VM runtime functions;
  • extra 1 is for JIT compiler recursion in main thread;
  • 4096 is the default page size.

E.g. for 32-bit Windows JVM minimum stack size = (3 + 1 + 4 + 2*4 + 1) * 4K = 68K

BTW, you may reduce the minumum required stack size using these JVM options: (not recommended!)

What is the difference between -Xss and -XX:ThreadStackSize?

I just want to control the stack size for all of my threads in a Java (groovy) application. For the Hotspot Oracle VM, I know that there are two parameters doing that ( -Xss and XX:ThreadStackSize ).

Which is the preferred one? Is there any difference between them? Regarding Open JDK 7 someone asked on the mailing list, stating that -Xss is the same for the Hotpot VM as -XX:ThreadStackSize .

The point is, that I am measuring how many threads can be started on my system. My groovy script which does this looks like:

Interestingly enough I just get a reduced number of of threads using — XX:ThreadStackSize . I am starting the groovy application with and with different content in the environment variable JAVA_OPTS.

When I set JAVA_OPTS to -XX:ThreadStackSize=2m , I get about 1000 started threads until the memory is consumed. But, when I use JAVA_OPTS=’-Xss2m’ , I get about 32000 threads until the expected error arises. So it seems that -Xss does not work at all.

java version «1.8.0_05»
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)

on a Ubuntu 14.04 64 bit machine with four hardware threads and about 8 GB of RAM.

I reverified this on my Windows 7 64 bit machine and another JDK:

java version «1.8.0_20» Java(TM) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)

and there -Xss and -XX:ThreadStackSize work as expected (as some answers pointed out). So I suppose it is a Linux specific problem or even a bug in the JDK version 1.8.05.

Оцените статью