Too many open files # rb_sysopen - ruby-on-rails

I am raising this problem again and again on my live server. Please help me out with the problem. My project is on windows so how I can increase the limit on windows.
I have seen the solution but this is given for Ubuntu. How I can do the same on windows?
EMFILE is too many files opened in your process.
ENFILE is too many files opened in the entire system.
So Errno::EMFILE is due to the ruby process opening too many files. This limit is probably set to the default 1024 can be seen with:
$ulimit -n
1024
Instead of:
$ulimit
unlimited

Related

How to change location of the bazel caching area?

I am trying to run bazel from a company-installed location. It decides to use my home directory for some caching and extracting installation files. There is no much space (company policy). So, the question is: how to redirect it to a different location? I could not find much on the web.
WARNING: Output base '/home/name/.cache/bazel/_bazel_name/b05102fc551c33214ce89fb43ea90837' is on NFS. This may lead to surprising failures and undetermined behavior.
Extracting Bazel installation...
FATAL: Failed to extract embedded binaries: Failed to write zipped file '/home/name/.cache/bazel/_bazel_name/install/f6ca571514ebc1be8327564b4455aae2.tmp.10086/_embedded_binaries/A-server.jar': (error: 122): Disk quota exceeded
Also, not sure why it thinks that this is NFS. I try to run it onlinux.
found it: bazel --output_user_root=<loc> fixes the issue.

build errors when compiling in ac-docker win10 asking to rebuild compiled header since a file has been modified since the precompiled header

here is a copy of a few erros but the are to many to list in the post maybe 50 total all same error just different file names
fatal error: file '/azerothcore/src/server/game/Entities/GameObject/GameObject.h' has been modified since the precompiled header '/azerothcore/var/build/obj/src/server/game/CMakeFiles/game.dir/cmake_pch.hxx.pch' was built: size changed
note: please rebuild precompiled header '/azerothcore/var/build/obj/src/server/game/CMakeFiles/game.dir/cmake_pch.hxx.pch'
1 error generated.
make[2]: *** [src/server/game/CMakeFiles/game.dir/build.make:154: src/server/game/CMakeFiles/game.dir/AI/CoreAI/GuardAI.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
how can i do this step and rebuild my precompiled headers in docker build of ac? also my world database keeps bloating up in size huge amounts went from 8gb to 16gb to 28 gb since most recent new build yesterday files from 10/11/2021
Probably this is because of the ccache, which is the cache that allows you to have super-fast compilation, but sometime the header cache fails because of a high amount of changes, and it must be cleaned.
So, Please try this:
./acore.sh docker dev:dash compiler ccacheClean
it should clean the ccache, then you can restart the compilation
PS The problem about the database size is related to the configuration of MySQL. InnoDB usually stores a large amount of Binglogs that should be cleaned. But please open a separated question for that. AC provides the default MySQL configuration and the system admin should tune it based on its needs
the only way i was able to fix my problems was at a personal cost to hours spent with creating so much custom content, only to be lost. i rebuilt a clean server and then only imported my AUTH and CHARACTER databases, problems solved. the build is 100% working as intended, but will have to slowly and painfully redo all my custom work that was done in the WORLD database.

Fatal error: Allowed memory size exhausted after MAMP update

I know this question can be found a lot of time on this forum and the internet. But I can't seem to find the answer to my specific question.
I'm running a Drupal website, and since the update of MAMP from 5.5 to 5.6 I get the following error:
Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) when running a composer require in the terminal.
I updated the php.ini tot 1024MB instead of 128MB of the current php version I'm running via MAMP. When I add a php file to my root with <?php phpinfo(); ?> I see that the memory is like I want so 1024MB. When I look at the location of the php ini file I see it is in the MAMP folder.
But I still get the error. When I run this php -r "echo ini_get('memory_limit').PHP_EOL;" in my terminal I see the 128MB again. When I try to find the php ini that is running using
php -i|grep 'php.ini' I get:
Configuration File (php.ini) Path => /etc
So it looks like the php.ini file is somewhere else. But I don't know where and can't change it. How can I solve this?
I also tried changing the composer memory using php -d memory_limit=-1 /usr/bin/composer but this didn't solve the problem either.
My question is, how can I solve this problem? How can I find the php.ini file that is used. Or how can I change the memory limit?
Update:
Running php -i | grep 'Configuration File' in the terminal ouputs:
Loaded Configuration File => (none)
And maybe good to know that I have the option Make this version available for command line enabled on the MAMP php section.
I tried many of the suggestions on this and a few other stack overflow questions but couldn't get it to work until I tried:
COMPOSER_MEMORY_LIMIT=-1 composer require 'yourpackagenamehere'
Just trying COMPOSER_MEMORY_LIMIT=-1 by itself before running the command didn't seem to work. Not sure why, but I had to run them on the same command line in a similar way as documented in the composer troubleshooting: https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors
I ended up adding a php.ini file to the /etc folder on my computer. This way the php memory_limit raise did work. And checking it in the terminal did show me the right value. But as Alister already said, this didn't fix the problem. The problem was not in the php.ini memory_limit.
I found out that using COMPOSER_MEMORY_LIMIT=-1 in the terminal at the beginning of my session put the memory limit to unlimited during that terminal session. This fixed the problem.
After that I added, alias composer="COMPOSER_MEMORY_LIMIT=-1 composer" to my bash file and know everything is working like I would expect.
Changing the amount of memory in php.ini won't help - that is the limit for what is being used by the webserver's version of PHP - and having too much available for the webserver can cause problems (at least when running in production).
Composer, when it is being run from the command line, will, by default set the limit to 1,610,612,736 bytes - 1.5 GB.
As you are apparently still on PHP 5.6, that's also a very considerable problem. PHP 7+ is a great deal more efficient with memory, as would be an up to date version of composer.
Finally, to actually solve the problem: Restrict your requirement to be more specific since that keeps memory usage lower.

Xcode server bot failing test action because "Too many open files in system."

The error I'm seeing is as follows:
Test target PrototypeTests encountered an error (The operation couldn’t be completed. Too many open files in system. Too many open files in system)
Test target Prototype Integration Tests encountered an error (The operation couldn’t be completed. Too many open files in system. Too many open files in system)
I am able to run the analyze and archive actions with no problems but enabling the test action causes the above errors. I've even tried this with empty tests and the problem still persists.
The output of sudo launchctl limit maxfiles on my server is:
maxfiles 256 unlimited
Please let me know if I can provide any more information.
You need to increase your ulimit. You should add the line:
ulimit -n 4096
in your ~/.profile or similar.
The reason you have to add this line to your bash launch file is because just running sudo ulimit -n 4096 will only change the limit in current bash session.
I received this same message while trying to compile while low RAM, low disk space, and many open apps & files on my desktop. Closing most of them and emptying the trash resolved the issue.

Resolving Address Space is already occupied error using Cygwin and Ruby

I keep getting the same type of error messages and I have really done all I can to get rid of them. The message is as follows, only the module can vary at times:
ruby 5740 child_info_fork::abort: address space needed by 'date_core.so' (0x600000) is already occupied
These messages occur at various times when trying to run Rails, such as “rails console”.
I am running the following environment:
Windows 7 Ultimate 64-bit
Cygwin Net using setup 2.774 (installed from Internet mirrors)
Ruby 1.9.3p392
Rails 3.2.11
I have taken the following steps attempting to fix this:
Deleted all BLODA and restarted, including Norton 360 and Malwarebytes. (BLODA is Big List of Dodgy Apps.)
Deleted and reinstalled Cygwin.
Executed “rvm implode” and rebuilt the RVM and Ruby on Rails environment.
Used CMD & ASH to run “peflagsall” & “rebaseall”. Ran “rubyrebase”. Restarted.
Used FIND to build a file of all *.so & *.dll files. Ran “rebase -T”. Restarted. This has also been done using the “-b 0x77000000” switch.
Used same file to create “to_peflags” script issuing peflags against each individual file. Restarted.
All repair attempts have been futile. At times, “rebase -si |grep ‘*’” would be clean. Any attempt to run “rails console” or similar commands results in Address Space Occupied messages. Subsequent “rebase -si” would then again show conflicts.
I have been trying to run “peflags” against the Ruby modules, but I only get “skipped because could not open” error messages there. File permissions and ACL both show correct permissions. The same error occurs whether or not Administrator is used.
This is pretty frustrating. I would like to fix my current environment, but I am considering moving to MSYS or SFU, but I don’t know if either of those are decent options. I am also considering going native UNIX, but I’ll leap off the cliff when I get to it.
For now, does anyone have a fix for this specific error for me? Thanks…
I have used procexp to monitor "rails console" execution. Bash is calling cmd.exe to run the rails.bat file. Cmd.exe runs in ASLR mode. Used Microsoft EMET 3.0 to turn off mandatory ASLR and bottom up ASLR for both bash and cmd. Cmd.exe still runs in ASLR mode. It must be compiled that way.
Updated registry to set HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\MoveImages to 0, -1 then 1. 0 caused system problems. -1 had no effect. 1, which was supposed to be the default, helped somewhat as long as EMET changes were in place. But, it was unreliable as Address Space Occupied would eventually recur.
Decided to attempt to install a command processor that either didn’t require ASLR or allowed me to disable it using PE flags. I installed TCC/LE and attempted to get Cygwin Bash to use it to process .bat files. I tried using the path variable, the COMSPEC variable and changes to batfile and cmdfile in the registry all to no effect. Cygwin Bash must either have it hard coded or some nonobvious control.
My fix is to replace my environment. I know I will eventually migrate to some Unix, but for now I am converting to MinGW/MSYS and RubyStack. All I want to do is to get a stable RoR (Ruby on Rails) environment running for today. I don’t see that happening using Cygwin with Windows 7 Ultimate. I keep running into too many problems and this one is a very, very tough nut to crack. Thanks…

Resources