10000 [FrameworkBundle] print error message if server couldn't be started by xabbuh · Pull Request #12258 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[FrameworkBundle] print error message if server couldn't be started #12258

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

xabbuh
Copy link
Member
@xabbuh xabbuh commented Oct 19, 2014

As @weaverryan noticed in symfony/symfony-docs#4005, the server:run command would provide you with a success message even if there were a web server already listening.

@weaverryan
Copy link
Member

@xabbuh Wow, you're awesome fast today! I just opened an issue for this (#12259), which I'll close now (since you have the PR open).

Thanks!

@xabbuh
Copy link
Member Author
xabbuh commented Oct 19, 2014

@weaverryan Can you leave it open for a while? This fix does only work when you execute server:start several times. It isn't able to detect if the server was started with server:run, for example.

@fabpot
Copy link
Member
fabpot commented Dec 12, 2014

@xabbuh Any news on this one?

@xabbuh
Copy link
Member Author
xabbuh commented Dec 12, 2014

@fabpot I'm actually not sure how we could fix this best. Should we test with fsockopen or something similar if the socket is free?

@xabbuh xabbuh force-pushed the server-start-error-handling branch 2 times, most recently from 84a5ae6 to 1343ae3 Compare December 30, 2014 10:41
@xabbuh
Copy link
Member Author
xabbuh commented Dec 30, 2014

I updated the pull request. The command now tries to connect to a server listening on the socket to check if the socket is free to be used by the built-in web server.

@fabpot You will be able to rebase this onto the 2.6 branch and apply it there, right?


list($hostname, $port) = explode(':', $address);

return @fsockopen($hostname, $port, $errno, $errstr, 5);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should close the socket again before returning in case you manage to open it, to avoid leaking a socket descriptor

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@xabbuh xabbuh force-pushed the server-start-error-handling branch from 1343ae3 to 10e724b Compare December 30, 2014 11:34
@fabpot
Copy link
Member
fabpot commented Jan 18, 2015

Thank you @xabbuh.

fabpot added a commit that referenced this pull request Jan 18, 2015
…e started (xabbuh)

This PR was submitted for the master branch but it was merged into the 2.6 branch instead (closes #12258).

Discussion
----------

[FrameworkBundle] print error message if server couldn't be started

As @weaverryan noticed in symfony/symfony-docs#4005, the `server:run` command would provide you with a success message even if there were a web server already listening.

Commits
-------

6b2537b print error message if server couldn't be started
@fabpot fabpot closed this Jan 18, 2015
@xabbuh xabbuh deleted the server-start-error-handling branch January 18, 2015 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0