I built a console app with Symfony Console component. It supposed to be run for 5 hours. But after running 2 hours i have a proc_open(): unable to create pipe Too many open files error in Symfony\Component\Console\Application.php on line 985.
I tried gc_collect_cycles in my loop, but got the same error.
Is this a Symfony Console component bug or i should not run an app for this long (but i have to)?
I had this same error with a Symfony web-app, and restarting PHP resolved it.
I appreciate that you can't do that in the midst of your command's 5-hour run, but maybe doing it immediately beforehand will get PHP in a clean enough state to give you the full 5 hours?
(Also, this post is the only one I found about my problem, so I wanted to add this here in case others have the same issue as me!)
This issue is related to:
https://bugs.php.net/bug.php?id=47396
Apparently you're working on a lot of resources in your app. It's not a Symfony Console bug, it's a PHP bug.
You can use another programming language or modify your program in order to open less files.
Related
I am currently working on the project that has over 20 crons. Some of them are pretty long processes. It was built on Symfony 2.8, so we decided to upgrade it to 3.4 LTS.
After the upgrade we noticed that, if there is ongoing cron job (long process) and we push some changes to Prod environment we get this error:
Fatal Compile Error: require(): Failed opening required '/.../cache/prod/
Turns out, that when we deploy the changes, cached container (in var/cache/prod/ContainerXXXXXX) changed the XXXXXX value. Or in other words, we clear the cache (during deploy) and then it generates new Container in cache directory. More about this problem: https://github.com/symfony/symfony/issues/25654 .
So, I came up with the idea, add a script with a while loop (?) which checks if there is any running crons, if not run the deploy.
But the question is, is there a way to check this in current situation?
There are many ways to achieve this. Just any kind of semaphore (a file, a database record) to store the "running" status and have the same process clear it when it's done.
Any deployment job should check the value of this semaphore before continuing. A simple flat file would be easiest, since you may not have access to more sophisticated features during deployment, but reading a text file should be easy no matter what kind of of deployment process you are using.
This happened to me a couple of months ago. It might have happened in the process of a composer update, but I'm far from sure on that one. I've even updated my project to Laravel 5.3 and it still I can not get make:migration to work through Artisan. No the project it updated to 5.4 and it still do not work.
I've checked out this thread and I have the exact same problem. The symptoms were exactly the same, however the OPs solutions did not work for me.
I get no error or result in the terminal when running make:migrate.
I can generate any other file through Artisan it seems.
I tried to create a new model and pass the -m along with it. Didn't work.
I've checked permissions (and even changed migration folder), but didn't
help.
If I create my own migration-file the rest of the process through artisan works fine (migrate, DB-manipulation etc).
I've tried with different terminals and computers.
Since project were upgraded and even reinstalled I fear it has
nothing to do with the deep kernal. However maybe some sort of conflict from the higher level.
And in the last phase of my quest I tried to figure out what user interacting elements that can possibly effect the make:migration. Nothing worked.
I searched the web without any solution, then I gave up on that project and started to make my own migration files. However I now got some new hope when I saw that other thread.
After some troubleshooting I finaly managed to figure out the problem.
I narrowed it down to have something to do with the config/app.php-file.
Seems I in this project had typed in:
'timezone' => 'UTC+2'
This made creation of migration-files come to a halt without error messages. And it effected only the creation of migration-files (at least what I noticed).
I changed it to 'UTC' and it worked liked a charm again.
Note: the 'UTC+2' worked in the application and I never saw any other indications of errors regarding the rest of the app.php-file, or in the application in general.
Solution: When I instead used the parameters from this site it all worked perfectly again.
I have a problem with Symfony 2. trying the example from the book. I have written a controller but when i go to the URL specified in the route i get an error. The server can't find the page. When i run app_dev.php i get an error that the file boostrap.php.cache is missing.
searched on the internet but found nothing relevant so far. I don't know if the front-controller is already written or if that is something that still has to be done by me.
I can't get the application to run.
Found the solution. I followed the guidelines installing sf2 in netbeans. Instead of running the application as a local website i used the build-in server option wich gave me access to the cli commands. There i could use the command run server and all of my problems were gone.
Just playing with Laravel 4 for the first time after using version 3 for a few projects but can't seem to get Artisan to work at all. I've done a bunch of searching and followed the troubleshooting steps I could find but no luck.
I've got Mcrypt installed
I had no bootstrap/compiled.php file to delete
I have the latest version of the framework from Github
I am on the latest version of Composer
When I try "composer update" I get this error:
Script php artisan optimize handling the post-update-cmd event returned with an error:
...with no extra information.
Trying to run "php artisan list" or any other artisan command just gives me no output at all.
Any ideas?
To summarise the discussion in the comments, we discovered that adding logging at the php.ini level revealed a PHP error that was not reported by the Composer console interface. I wonder whether you had installed Composer as root, and so some critical files required by Laravel were effectively invisible for a non-privileged user.
After running phpinfo, I noticed "--disable-mbregex" was part of the PHP configuration, meaning PHP was not compiled with the mbregex extension. My error logs were showing "Call to undefined function mb_regex_encoding".
Once PHP was recompiled with mb_regex_encoding, the issue went away.
If you are missing the /bootstrap/start.php file, you don't get helpful error messages from artisan and composer responds the same way. I went around and around trying solutions I found online and ultimately discovered this file was missing. I was back online as soon as I replaced it. I discovered this file was missing in my PHP error logs and artisan wasn't generating logs since it was unable to run.
I had a similar problem. Even the command $ php artisan --verson would not produce any output. Turned out, I had some code under app/start/global.php which was breaking under the CLI execution (but not breaking on the web side).
So that's another place to check for stuff! (app/start/global.php)
I was getting this problem, and it was because the subdirectories of storage did not yet exist.
Of course, these directories are created by the project-creating script, but they're quite easy to leave out of source control and so will be missing on a freshly cloned project. The .gitignore files are in there for a reason it would seem!
This problem occurred for me when there were files in the storage folder that were not writable for the current user. php artisan silently failed, without output. Changing permissions helped.
Im trying to learn how to set up a Zend framework web application from scratch. Ive been using Magento and I understand how powerful Zend is, but im over my head it seems like.
So I bought a book, developing web applications with Zend 1.8 by Keith Pope, and I cant even follow past the first chapter. The thing that is confusing the hell out of me is the whole command line deal.
Here is a passage from the book --
Once we have downloaded the Zend Framework release package, we need to do some basic installation before we can start creating our application. First, create a new directory within your web server's document root, from which the application will be served. The examples in this chapter use the directory name of helloZend. Next, copy the library and bin directories from the release package into the newly created directory. The library directory contains all of the Zend Frameworks
source files, and the bin directory contains the command line interface for the
Zend Framework. The Zend Framework is now installed and ready for use!
Creating the project structure
We are now ready to start creating the directory structure for our project. In order to do this, we are going to use the command line interface provided by the Zend Framework. This interface uses the Zend_Tool component that provides a whole host of commands that makes it very easy to get up and running with the Zend Framework in just a few minutes.
In order to create the project structure, open up your command line and change into the hellozend directory, and then run the following command:
For Windows users:
bin\zf.bat create project
For Linux and Mac users:
bin/zf.sh create project
Ok so Ive done all that. But up above in first part he says upload it to your web server, did that already. But then "open up your command line", how exactly do I do this? The only command line I understand I can access is Terminal, do I do something with Terminal or??? (Im on a mac) - I tried navigating straight to bin/zf.sh on my webserver and it brought up a what do you want to open this link with, I chose terminal and nothing happened.
Can someone clarify this for me? I realize this may be a stupid question, but I have zero experience working with non live servers and what not....
I've been a ZF developer for several years, but was working on a pre- 1.5 version up until very recently (not by choice) I found it easiest to build a local version on my machine via ZendServer CE, then once all was running and stable, port it over to my dev server. Because I have full root permissions locally, I didn't run into any issues of naming/permissions as I walked through the initial tutorial of new features and initial setup.
Also, don't miss Akrabat's tutorial on getting started the ZF. It's very well written and in some cases easier to understand than the quickstart: http://akrabat.com/wp-content/uploads/Getting-Started-with-Zend-Framework.pdf
I don't say this to developers often, but you are in over your head if you don't yet understand how to open and use a command-line shell. Your question is not stupid -- everyone has to get started somewhere. But Stack Overflow is a place for specific questions about programming, like "I tried X and it didn't do what I expected, how should I code it instead?"
All I can suggest to you is to start studying. I believe that it's counter-productive to try learning new tools at the same time as trying to get a project done. So spend some time just learning the Terminal interface and how to run things in that environment.
Google for "Mac Terminal tutorial" and a bunch of useful articles and YouTube videos come up. Start there.
I also recommend "Mac OS X: The Missing Manual".
Re your comment: Okay, I think I'm seeing the source of your confusion. What the excerpt is not saying is that you need to open a shell on the host where you're developing your ZF app. What I do is to develop the project on my local host (my Macbook) so I can have quick access for moving files around and so on. This means I run an instance of Apache running on my Mac.
Then at intervals, when the app is running and done with respect to a given milestone of functionality, I upload the whole set of files I developed to my production server.
Tell me if I'm getting warmer. I really can't tell what you know and what you don't know because of the way you've asked your question.
anyone who needs the basic understanding of connecting to a webserver via terminal or command line via ssh should read the following:
http://www.elated.com/articles/ssh-and-basic-commands/
Although, the information there didn't work with my particular webhost. I had to format the connect command like this:
ssh user#host -p 1234
Where 1234 is the servers port number, which you will need to get from your webhost if you dont know it.
To run that script, navigate to directory where you've uploaded it (you open terminal, connect to your server via ssh if you're doing this remotely).
After that execute it like this:
./zf create project your_project_name
It should create new dir named "your_project_name" and in it many other sub-directories for your application.
Also, I'd recommend that you go for http://framework.zend.com/manual/en/learning.quickstart.html instead that book - Quick Start really is great.