X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 98E5D3858D34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSw.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=brian DOT inglis AT systematicsw DOT ab DOT ca X-Authority-Analysis: v=2.3 cv=LKf9vKe9 c=1 sm=1 tr=0 a=kiZT5GMN3KAWqtYcXc+/4Q==:117 a=kiZT5GMN3KAWqtYcXc+/4Q==:17 a=IkcTkHD0fZMA:10 a=peVNqDHSuqD3qN3S6RoA:9 a=5Mtwp4TsV9JRsu47:21 a=5dycKySdZGU0sSAM:21 a=QEXdDO2ut3YA:10 Subject: Re: Cygwin PHP (all available versions) has a hard 4MB memory limit To: cygwin AT cygwin DOT com References: <1027954883 DOT 77500 DOT 1595086445002 AT smtp4 DOT opayq DOT com> From: Brian Inglis Autocrypt: addr=Brian DOT Inglis AT SystematicSw DOT ab DOT ca; prefer-encrypt=mutual; keydata= mDMEXopx8xYJKwYBBAHaRw8BAQdAnCK0qv/xwUCCZQoA9BHRYpstERrspfT0NkUWQVuoePa0 LkJyaWFuIEluZ2xpcyA8QnJpYW4uSW5nbGlzQFN5c3RlbWF0aWNTdy5hYi5jYT6IlgQTFggA PhYhBMM5/lbU970GBS2bZB62lxu92I8YBQJeinHzAhsDBQkJZgGABQsJCAcCBhUKCQgLAgQW AgMBAh4BAheAAAoJEB62lxu92I8Y0ioBAI8xrggNxziAVmr+Xm6nnyjoujMqWcq3oEhlYGAO WacZAQDFtdDx2koSVSoOmfaOyRTbIWSf9/Cjai29060fsmdsDLg4BF6KcfMSCisGAQQBl1UB BQEBB0Awv8kHI2PaEgViDqzbnoe8B9KMHoBZLS92HdC7ZPh8HQMBCAeIfgQYFggAJhYhBMM5 /lbU970GBS2bZB62lxu92I8YBQJeinHzAhsMBQkJZgGAAAoJEB62lxu92I8YZwUBAJw/74rF IyaSsGI7ewCdCy88Lce/kdwX7zGwid+f8NZ3AQC/ezTFFi5obXnyMxZJN464nPXiggtT9gN5 RSyTY8X+AQ== Organization: Systematic Software Message-ID: <48ce92cb-a25e-cd9c-fe61-01a6a9cf2cf0@SystematicSw.ab.ca> Date: Sat, 18 Jul 2020 11:32:12 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <1027954883.77500.1595086445002@smtp4.opayq.com> Content-Language: en-CA X-CMAE-Envelope: MS4wfFTa7dEjB0tmPC4aCVkSi0gyUpCra7IQAYnlq+m6pZAI39qR5EofiCqL8P4Gy1QZTN8y87kac3b2ZHwyPfK3lX0wTph7Sbx7CwuMFEhPam+V3ntTZafV /QwSzad1uL6BLq86dybqIVWw6+GWFelJuZyqYGK36SiB/fddU5q0EUc9bL4EvZLLN8u5CMu9ZzEuJg== X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: cygwin AT cygwin DOT com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" On 2020-07-18 09:33, km2z7kca0oge--- via Cygwin wrote: >> You told us nothing about what versions of Windows, Cygwin, and PHP you are running, so WAG, either: > Wow Brian, what a rude response. I definitely followed the problem reporting guide, and didn't realise you'd need information overload that probably doesn't relate to the case at hand. When reporting bugs I always give as much info as I believe is needed in helping, there's no need to snap. You did not specify Windows, Cygwin, Web server type, PHP, or Zend versions or include the *required* cygcheck.out attachment which shows all this. Many problems are because Cygwin and/or package releases have not been upgraded for weeks, months, or even years, or reports do not include verbatim commands and output, which may contain or clearly show symptoms of obvious errors, or suggest a reproducible test case. Most problems are unique to the reporter's system, otherwise others would have reported it, and it would be known, and possibly fixed by volunteer maintainers. More information than one might think is often required to diagnose the problem with your unique situation and suggest a solution or provide a fix. Many of the most knowledgeable and experienced volunteers providing support will not even look at emails which don't attach a plain text cygcheck.out, from which they can often diagnose a problem, suggest a workaround, further diagnostic steps, or provide a fix. Others of us try to nudge people into providing sufficient information so that those with the most relevant knowledge and experience may take a look at the issue, if they have time available, and suggest a further diagnostic, configuration change, or provide a fix. > I gave lots of information, such as: > - It applies to all bundled versions of PHP from the `setup-x86-64.exe`. > - That I've reproduced it on multiple (two) machines, including one of those being a machine that has never had (and so a fresh install of) Cygwin with just PHP added. > - Compiling PHP from source doesn't produce this issue so it's something to do with the bundled version only > > For extra information, both machines tested are: > - Windows 10 64-bit (10.0.18363) > - One machine is 16GB, the other 8GB RAM. > - All PHP versions from the `setup-x86-64.exe` (7.3.4-1 and 7.1.16-1) From below it appears you have also tested current PHP 7.3.7 with Zend 3.3.7. One common issue with Cygwin installations causing memory problems is when autorebase has not run or completed properly, so please try the following command on a failing Cygwin installation: $ awk '/0p_000_autorebase.dash"/,/zp_/' /var/log/setup.log.full and if you see the message: "The following DLLs couldn't be rebased because they were in use:" followed by a number of DLLs, please run: $ rebase-trigger full then ensure *ALL* Cygwin services and process are shut down: Win-R/taskmgr /7 OR ctrl-shift-esc - run Task Manager/select Details tab, right-click on column headings/Select columns/check Image path name/OK if required, sort by Image path name and see nothing starts with Cygwin installation root path, [possibly select menu Options/Set default tab/Details for next time,] and Exit), then rerun the Cygwin Setup program, and ensure that autorebase runs successfully to completion, as above. Another issue can be Windows memory management, so sometimes a system restart will resolve memory related problems, or if your system is under extreme memory loading at times (too little available/free) and you experience unexpected issues under load, you need to change Virtual memory paging management from Automatic to Custom by following: press Win-Break keys/select Advanced tab/select Performance Settings... button/ /select Advanced tab/select Virtual memory Change... button/ /Uncheck Automatically manage paging file size.../ /select a drive from the list/select Custom size/ /Initial size (MB)/8192 (or 16384 depending on memory size)/ /Maximum size (MB)/16384 (or 32768 depending on memory size)/ /select *Set* button [essential!]/repeat with other drive(s)/select OK button (3 times) to close dialogue boxes, then Exit System control panel. >> - you have defaulted to or specified a PHP configuration limit of 4MB memory for PHP tasks, or > Nope, as shown in the output of my example, the memory limit is set to 128MB: >> Output: >> $ php test.php >> 128M <--- This here shows the configured memory limit >> PHP Fatal error: Out of memory (allocated 4194304) (tried to allocate 2097184 bytes) in /c/Users/JackBlower/tmp-safe/test.php on line 5 > >> including copying verbatim all error messages seen > Here, the message was included in my initial email: > PHP Fatal error: Out of memory (allocated 4194304) (tried to allocate 2097184 bytes) in /c/Users/JackBlower/tmp-safe/test.php on line 5 > >> - if you're running 32 bit Cygwin, possibly under 32 bit Windows, you have probably run out of heap space from installing too many packages requiring too many DLLs. > Nope all 64-bit, I would've mentioned if not. > >> and PHP build configurations and logs. > See the output below for some more info, either way this is a pre-packaged version of PHP with very little changed from default configuration. > > ------------------------------ >> Greetings, km2z7kca0oge--- via Cygwin! > Hey Andrey, > > I've tried your script and I hit the 128MB limit, as expected. So maybe it's to do with the `http` wrapper. Could you try my version of the script please and see how you get on? > > I first bumped into this problem when I rolled back from composer 2.X to 1.X which uses more memory. > > I generated an 800MB file using: ` fsutil file createnew 800mega 838860800` and then ran your script you provided substituting your backup for the 800 MB file I generated. > > The output of the script is below: > ``` > $ ./test-mailing-list.php > #!/usr/bin/env php > phpinfo(1); > echo ini_get('memory_limit'), "\n"; > print number_format(strlen(file_get_contents('800mega'))); > phpinfo(); > phpinfo() > PHP Version => 7.3.7 > > System => CYGWIN_NT-10.0-18363 AML0147 3.1.6-340.x86_64 2020-07-09 08:20 UTC x86_64 > Build Date => Jul 21 2019 16:57:32 > Server API => Command Line Interface > Virtual Directory Support => disabled > Configuration File (php.ini) Path => /etc > Loaded Configuration File => /etc/php.ini > Scan this dir for additional .ini files => /etc/php.d > Additional .ini files parsed => /etc/php.d/bcmath.ini, > /etc/php.d/bz2.ini, > /etc/php.d/curl.ini, > /etc/php.d/fileinfo.ini, > /etc/php.d/gd.ini, > /etc/php.d/gmp.ini, > /etc/php.d/intl.ini, > /etc/php.d/json.ini, > /etc/php.d/ldap.ini, > /etc/php.d/mbstring.ini, > /etc/php.d/pdo_mysql.ini, > /etc/php.d/pdo_pgsql.ini, > /etc/php.d/pdo_sqlite.ini, > /etc/php.d/phar.ini, > /etc/php.d/posix.ini, > /etc/php.d/simplexml.ini, > /etc/php.d/sockets.ini, > /etc/php.d/sodium.ini, > /etc/php.d/sqlite3.ini, > /etc/php.d/tokenizer.ini, > /etc/php.d/vld.ini, > /etc/php.d/xmlwriter.ini, > /etc/php.d/zip.ini, > /etc/php.d/zlib.ini > > PHP API => 20180731 > PHP Extension => 20180731 > Zend Extension => 320180731 > Zend Extension Build => API320180731,NTS > PHP Extension Build => API20180731,NTS > Debug Build => no > Thread Safety => disabled > Zend Signal Handling => enabled > Zend Memory Manager => enabled > Zend Multibyte Support => provided by mbstring > IPv6 Support => enabled > DTrace Support => disabled > > Registered PHP Streams => https, ftps, php, file, glob, data, http, ftp, compress.bzip2, compress.zlib, zip, phar > Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2 > Registered Stream Filters => string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, bzip2.*, zlib.* > > This program makes use of the Zend Scripting Language Engine: > Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Technologies > 128M > PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 838869024 bytes) in /c/Users/JackBlower/tmp-safe/test-mailing-list.php on line 5 > ``` > > Notice how this time it's running out of memory at 128MB and has the "Allowed memory size" error instead of the "Out of memory" error from before. -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada This email may be disturbing to some readers as it contains too much technical detail. Reader discretion is advised. [Data in IEC units and prefixes, physical quantities in SI.] -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple