nginx php-fpm xdebug netbeans can start only one debug session - debugging

In the past, I've used apache+mod_php+xdebug+netbeans for development my website (server is my local machine, running Debian Squeeze), with pleasure - xdebug worked just as expected, debug sessions could be started and stopped any time, when I need it. But, when I moved to nginx+php_fpm+xdebug+netbeans I've experienced some problems with debugging.
My debug session could be very long (much more than 30 seconds) and it seems, that nginx couldn't wait so long, it shows "504 Gateway timeout error". I've tried lots of recommendations for solve this, but no luck. Though, it is not a very important for me, because of debugging session itself continues to run, and it's just a little uncomfortable thing.
My debug session could be run only once, so, if I stop it, and try to launch debugging again, netbeans couldn't accept connection from xdebug (it writes "Waiting for xdebug connection" and it is forever). After restart of netbeans the debug session could be started again normally.
In come cases, that I couldn't understand, the debugging is "turning on for all php scripts" and prevent's any other scripts to run. For example, I start debug session on my website's http://mysite.local/index.php and working with it. After some time, I noticed, that my adminer (placed on intranet.local/adminer.php) doesnt run, the browser tries to load page for some time, and than shows "504 Gateway timeout error". If I see this behavior, I could just stop xdebug debug session in netbeans, and all other scripts starting to operate normally.
Now, when I writing this question, I made some investigations, and found, that, if I start debug session for some seconds, after that stop it, and start again - it starts normally. It seems like the problem appears after some time of active debugging.
My system and apps:
Debian squeeze:2.6.32-5-686
Nginx: 1.4.1 (from dotdeb repository)
php5-fpm: 5.3.26-1~d (from dotdeb repository)
php5-xdebug: 5.3.26-1~d (from dotdeb repository)
netbeans: 7.3
My config:
nginx base config: https://gist.github.com/MihanEntalpo/6229801
nginx website config file: https://gist.github.com/MihanEntalpo/6229781
fastcgi_params file: https://gist.github.com/MihanEntalpo/d93fd4105573e1eda56f
php-fpm pool config file: https://gist.github.com/MihanEntalpo/6229820
php-fpm xdebug config file: https://gist.github.com/MihanEntalpo/6229836
netbeans: options, that was just the same with apache server:
Break on first line = OFF
Evalution in popup window = ON
Show requesting URL's = ON
Port = 9000
Record in nginx's error log file, when it cannot wait for script being debugged, or other script, locked by the problem #3, mentioned early:
2013/08/14 14:40:16 [error] 4822#0: *111 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 192.168.100.1, server: intranet.local, request: "GET /adminer.php?username=root&db=devel&table=user HTTP/1.1", upstream: "fastcgi://127.0.0.1:9999", host: "intranet.local", referrer: "https://intranet.local/adminer.php?username=root&db=devel"
php-fpm's logs doesn't contains ANY error messages...
I don't like to disturb anyone with my problems, and always trying to solve it by myself. But in this case, I'm fighting with this ones for some MONTHS without luck...
If anyone faced this problems, or have working config for using with nginx+php-fpm+xdebug+netbeans - please help me :)

Thank you, everyone who tried to think in the direction of my problem.
I've solve it successfully.
First problem (with 504 error) could be solved by nginx option fastcgi_read_timeout, for example, it could be fastcgi_read_timeout 600; for tell nginx that it should wait for 600 seconds. It should be placed to host's config file, or to /etc/nginx/fastcgi_params (in Debian)
Second problem was caused by option in my xdebug.conf: xdebug.remote_autostart=1;, it should be xdebug.remote_autostart=0;. I doesn't understand the real meaning of this option, but it does following: Any php script automatically trying to connect to debugger (netbeans in my case). So, in some case, netbeans loses a connection, and when I press "Start debugging", it doesn't know, that new connection should be opened, and waiting for xdebug client forever. Now, with the mentioned option, I can start and stop debugging any time when I need it.
Third problem had the same source, as the second one. All others scripts, running on my server have tried to connect to netbeans, but with lost connection it was senseless.
Anyway, I hope this would help someone, who want to solve similar problems. StackOverflow helped me by forcing me to definitely describe my problem, and in this process I've gained new ideas on what to try.

When updating fastcgi_read_timeout you can increase the time limit for all sites on the server (vagrant homestead VM in my case) you can do the following once you've SSH'd into your VM:
sudo pico /etc/nginx/nginx.conf
and add
fastcgi_read_timeout 300;
to the http section.

For everyone having the same problem where the accepted answer did not work, in my case, it was a recently installed application that was blocking xdebug.
My company has remote access to install security software on my laptop so they installed ESET Endpoint Security.app and ESET Remote Administrator Agent.app which apparently also filters localhost connections. It took me two days until I finally noticed that there was an ESET daemon running and blocking connections on 127.0.0.1:9000.
The solution was to move to trash both applications since I don't have the necessary admin privileges to disable filtering in the application settings.

Related

Firefox no longer works through ssh -D tunnel

Quite a while ago I started using an ssh tunnel so I could access services back in the Uk that require a UK client address (such as my library and my doctor).
So I have been using "ssh -fTnN -D 1080 chris#isbd.uk" and setting up the proxy configuration in Firefox to use host 127.0.0.1 and port 1080.
However this didn't work when I was in France last week, I'm not sure when it stopped working (maybe in the last year or so), it now give an error:-
Secure Connection Failed
The connection to the server was reset while the page was loading.
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the web site owners to inform them of this problem.
Has anyone any idea how to fix this? The proxy works for things like curl and lynx so it would seem to be a Firefox issue brought about by security paranoia.
Found this because I had the same problem today - same error message, no useful information - on fedora-34 using Firefox 94.0 and OpenSSH_8.6p1. Also tried GNU Icecat 78.15.0esr same result. Can't test cromium-browser because the system proxy settings need Network Manager, curl with --preproxy sockst5://127.0.0.2:3128 works fine.
Thought my server config was broken but it also applied to all other connections while the browser was set to use the proxy and the system I was worked from other setups where one ff version is in between the two I tested on fedora-33 and the other being version 94.0.1-1 on arch.
that's as far as I'm willing to invest time to debug this for now

How do you configure Laravel and RabbitMQ?

Let me start by saying I am quite the novice when it comes to server development, so not being able to even setup a learning project is not my proudest moment, but here it goes:
I have a Laravel 8 project, with an AMQP wrapper installed from here: https://github.com/bschmitt/laravel-amqp. Aside from that, I have the rabbitmq:3-management Docker image running.
Now, if I try to open the management console through localhost:15672, use the guest:guest creds, everything is fine. If I try to telnet localhost 5672 and enter a random string as suggested here: http://rubybunny.info/articles/troubleshooting.html , everything is still fine.
I have an amqp.php file in my config as suggested here: https://github.com/bschmitt/laravel-amqp/issues/12, it changes nothing. I know for a fact that it changes nothing, because I at least managed to find where to hardcode my host and port, and got a bit "more positive" errors for a while, but I didn't manage to the same with the credentials.
All in all, without any hardcoding, and supposedly doing the configuration by the book, this is the error I get when I try to publish a message:
PhpAmqpLib\Exception\AMQPIOException
Error Connecting to server(0): Failed to parse address ":"
Any pointers would be appreciated.
So, all in all, I could not for the life of me figure out why my AMQP wrapper refused to have its config applied, so I removed it and went to trying to run the queue without it.
I could have been a bit more verbose in my question, what I called "more positive" errors, at best resulted in "Connection refused", which I immediately got when I went to the barebones implementation.
And because I'm still learning docker-compose from the ground up, it did not occur to me that instead of creating the connection based on "localhost", I had to use the name of the RabbitMQ container. Fixing that fixed everything.

On XAMPP for Windows: Apache closes abruptly

I started using XAMPP for Windows recently. Yesterday, it was working just fine, but not today. I had already disabled the use of port 80 and 4xx from Skype (after seeing lots of posts about that) and had even removed the software from startup. MYSQL and FileZilla start just fine with XAMPP, but I get this when I try to use Apache (which I can install it as a service):
Attempting to start Apache app...
Executing "f:\xampp\apache\bin\httpd.exe"
Return code: 0
Status change detected: running
Status change detected: stopped
Error: Apache shutdown unexpectedly.
This may be due to a blocked port, missing dependencies,
improper privileges, a crash, or a shutdown by another method.
Press the Logs button to view error logs and check
the Windows Event Viewer for more clues
If you need more help, copy and post this
entire log window on the forums
Now, I am also getting this on Event Viewer: "Event Log is unavailable. Verify that the service is running." When going to services and I try to initialize Apache2.4, it gives me a message and later disappears from the Service list.
I can start Apache when I install the serivce and then click on "Start," but then it gets stuck on "Attempting to start Apache service..." and nothing happens.
I also click on Apache's "Start" without installing the service, and that's when I get the long error above.
When I click on "Start" again, after the "Attempting to start Apache service..," I get "Status change detected: running" and then immediately "Status change detected: stopped" and then again
Error: Apache shutdown unexpectedly.
This may be due to a blocked port, missing dependencies,
improper privileges, a crash, or a shutdown by another method.
Press the Logs button to view error logs and check
the Windows Event Viewer for more clues
If you need more help, copy and post this
entire log window on the forums
Not sure what to do now. Please help.
I am having identical issues. XAMPP was also working yesterday and this morning has not been able to start. My error log does not display anything from today, but some logs from yesterday are present. I will let you know if I find the answer...
EDIT: I reinstalled XAMPP and everything seems to work fine now. Not an ideal answer I know...
Maybe u have opned skype at the same time because Apache's port its the same as the skype.So when a conflit exist Apache refuse to respond.

zend studio debugger timing out

I am attempting to setup a remote profiling session with a server. I have downloaded the latest version of Zend Debugger, and have installed it on the server with the following setup - http://puu.sh/3ezyh/39247f2f15.png . With my local machine, I have setup a putty session to the remote server, and forwarded port 10137 as per the KB article listed on zend.com.
I am able to debug the remote server without a problem, however when I goto profile the page, the page will process, then a dialog will pop up with a "Waiting for the debugger's response" message. After approximately ~20 seconds, I get the following error: http://puu.sh/3ezDk/57f6dc1bb5.png .
However, there will be profiling information displayed , as well as execution statistics, but no execution flow, almost like it's getting part of the data but not all of it.
The page in question does have anywhere from a 20-30 second page load (which is why I'm tyring to profile to find the problem.)
The only error I can find is in the server's error_log, which just says "[Zend Debugger] Cannot send message"
Is there anyway to diagnose why I'm not getting the complete response?
I wonder if it is getting your IP address and trying to send directly to it instead of over the local forwarded connection. You might need to set your host IP to 127.0.0.1 as the address like in http://screencast.com/t/7lheaOlx. If that doesn't work I would say do a
tcpdump port 10137
And see what you can see. Also, depending on your local OS you may have a firewall blocking access to your instance of Studio.

Unable to run junit tests in Eclipse

I and my colleagues have an intermittent problem running junit tests or tomcat from within Eclipse.
Sometimes the tests will run.
Sometimes they will not.
There appears to be no pattern and we are not in sync. IE mine might run and others will fail.
Stopping/starting Eclipse can resolve the issue (sometimes).
Pulling out the network cable ALWAYS resolves the problem (while it is out).
When it fails the following happens.
On trying to run the class the Console screen appears with the red box.
The console screen stays blank for about 30 seconds and then the following appears:
Could not connect to: : 2083
java.net.ConnectException: Connection
refused: connect at
java.net.PlainSocketImpl.socketConnect(Native
Method) at
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
at
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
at
java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
at
java.net.Socket.connect(Socket.java:520)
at
java.net.Socket.connect(Socket.java:470)
at
java.net.Socket.(Socket.java:367)
at
java.net.Socket.(Socket.java:180)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.connect(RemoteTestRunner.java:560)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:377)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
The port number varies.
I found a forum post that told me follow this http://support.microsoft.com/kb/135982
But this did not work.
We are all on Microsoft XP based machines connecting to the internet via an
ISA server/proxy.
I am running Eclipse 3.3.3 and MyEclipse 6.0.1
Any ideas please ?
I have concentrated on junit instead of tomcat as it is much quicker & easier to reproduce.
Yep I had seen the McQueeney link with no luck.
We have done some more digging and interestingly when you run junit from Eclipse, Eclipse decides to go & check for updates, Yes that's right - everytime you run a junit (& I guess tomcat and others).
We removed a colleague's access restrictions to the WWW through the ISA server and low & behold the problem disappeared.
We are still monitoring this to see if it is the solution.
Watch this space.
I have tried looking through the Eclipse set up to see if I can stop it trundling off everytime to the WWW but have not seen a suitable option yet.
Some suggestions...:
Did you look at tomcat logs ?
Do you see in them some ClientAbortException: java.net.SocketException: Broken pipe. ?
It looks like the server thinks the client is closing the connection at times.
And like the client is getting the connection reset by the server (connection reset), and the server is not listening sometimes (connection refused).
If you are testing from behind a firewall/proxy server, you may need to provide TomCat with the firewall/proxy server hostname and port number.
Restarting eclipse should be enough:
Apparently the JUnit runner thread in Eclipse attaches to an Eclipse server thread to run the tests. It would seem the client thread was trying to connect to the wrong port (3393) or that the server thread that had been listening on port 3393 for runtime requests failed.
The solution McQueeney found is here (thank you Archive.org!)
One suggestion I find interesting is:
I had to change the jre that my Eclipse project uses to make sure that JUnit and my project were using the same jre. After a restart of Eclipse the error was gone.
I hope you will find a definitive cause for this.
I had the same problem, when my network driver was broken.
JUnit und Eclipse communicate via ICP (InterProcess Communication), better said: via TCP.
To run it successfully, you have repair your network drivers.
Try to reinstall TCP/IP protocols or turn it back to a system restore point.
Good luck!
So your JUnit only works, if there's a connection to the internet?
Or was it a one time action and now, it works without an internet connection?
Strange world... Are there any hints in a log file?

Resources