Stop Selenium 3.0.1 using command line - selenium

I tryied command from older versions, but it dont seems to work.
curl "http://localhost:5555/selenium-server/driver/?cmd=shutDownSeleniumServer"

'Old' command is not working because it's part of selenium RC which is not included in selenium 3.
You should now start your nodes with -servlet org.openqa.grid.web.servlet.LifecycleServlet included, and than you can shut it down with http://yourNodeIP:port/extra/LifecycleServlet?action=shutdown
I reported this issue few months ago and it's solved so you can check it out for more details here. https://github.com/SeleniumHQ/selenium/issues/2982

If you are on linux you can kill the process running on that port by
fuser -k 5555/tcp
or netstat -plten |grep java you will get the PID of seleniumserver process.
kill -9 PID.
Also try hitting the lifecycle of selenium grid2
http://yourHubIP:port/lifecycle-manager?action=shutdown
CTRL+c from your terminal also would help.
let me know if you are looking for anything else

Assuming you are running it on *nix and the standalone server is listening on the default port (4444)... you need to:
find the PID of the process that is bound to port 4444 (use lsof command)
send that process a SIGTERM to gracefully shutdown (use the kill command)
you can achieve this with the following one-liner:
$ lsof -t -i :4444 | xargs kill

Related

How do I kill a hanging TestCafe process using :::57664

I'm using TestCafe to test an app I'm working on. Today, when I went to run a TC test, I got the following message:
Error: listen EADDRINUSE: address already in use :::57664
I can usually handle these pretty easily: I issue the command:
lsof -i -P | grep -i "listen"
or
lsof -i tcp:57664
and then kill the offending task that is identified.
However, in this case, that port number isn't listed so I don't know which task to kill. also,
ps aux | grep -i "TestCafe"
doesn't show anything helpful.
Any suggestions on how to identify the hung task and kill it?

can't start rabbitmq-server after installation

I'm trying to use rabbitmq for a django tutorial but when I want to start the server I get this error:
~$ sudo rabbitmq-server
Configuring logger redirection
14:49:57.041 [error]
14:49:57.044 [error] BOOT FAILED
BOOT FAILED
14:49:57.044 [error] ===========
===========
14:49:57.044 [error] ERROR: could not bind to distribution port 25672, it is in use by another node: rabbit#wss
ERROR: could not bind to distribution port 25672, it is in use by another node: rabbit#wss
14:49:57.045 [error]
14:49:58.046 [error] Supervisor rabbit_prelaunch_sup had child prelaunch started with rabbit_prelaunch:run_prelaunch_first_phase() at undefined exit with reason {dist_port_already_used,25672,"rabbit","wss"} in context start_error
14:49:58.046 [error] CRASH REPORT Process <0.153.0> with 0 neighbours exited with reason: {{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","wss"}}},{rabbit_prelaunch_app,start,[normal,[]]}} in application_master:init/4 line 138
{"Kernel pid terminated",application_controller,"{application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,\"rabbit\",\"wss\"}}},{rabbit_prelaunch_app,start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,rabbitmq_prelaunch,{{shutdown,{failed_to_start_child,prelaunch,{dist_port_already_used,25672,"rabbit","wss"}}},{rabbit_prelau
Crash dump is being written to: erl_crash.dump...done
I've searched for port to see that if it's in use or not and I used lsof -i :25672 and I get nothing.
I don't know too much about these things so if you need anything please tell me.
Try:
sudo lsof -i :25672
sudo kill <PID>
sudo rabbitmq-server
Where <PID> is the process ID that is occupying port 25672
I have encountered this issue. I figured out that this issue is coming because the rabbitmq-server is already running on the machine.
I have used the following command
rabbitmqctl.bat status to know the status of the rabbitmq-server. This helped me to know if the server is up or down.
If it is up, this could the reason you are getting the error that you have specified in your post.
You can issue the following command to make the server down
rabbitmqctl.bat stop
Now you can try starting the rabbitmq-server by issuing the following command
rabbitmq-server start
Note that I am using Windows. And I have executed these commands by pointing the command prompt to C:\Program Files\RabbitMQ\rabbitmq_server-3.8.14\sbin as my rabbitmq installation directory is C:\Program Files\RabbitMQ\rabbitmq_server-3.8.14.
I have encountered this before. Here is what caused it and how I fixed it:
This is one of those commands which requires the magic word sudo (i.e it needs a superuser privilege).
If you forget to add sudo to the command, it begins the process but later fails when it hits a superuser-only roadblock. This leaves you with an incomplete process. Now when you decide to add sudo, it attempts the same process again but finds out that someone without the right privilege has made a mess or is still messing around.
Then the solution will be to cancel out whatever the first command has started and try again.
sudo lsof -i :25672
This list out details about the port 25672
You will see the PID (process ID) e.g 1301
Then stop the process on that port with:
sudo kill <PID>
for example, sudo kill 1301
And make sure you are killing the right process if not you may get into trouble.
Now, retry the command with sudo:
sudo rabbitmq-server
ALSO,
In most cases, this error occurs because without deliberately stopping the rabbitmq-server, it always keeps running even after you restart you system.
another way to stop rabitmq server windows+R then type "services.msc" and then find for RabitMq.slelect and stop from left top corner.
Then re run your rabitmq server.
-Hi guys, I am putting up an answer that can help Googlers to run multiple rabbitmq-server on the same machine. Trying to achieve the latter, I ran into a similar error reported in the first place and solved that by defining:
export RABBITMQ_DIST_PORT=anything_other_than_25672
as stated in the documentation:
https://www.rabbitmq.com/networking.html#epmd-inet-dist-port-range
if you are using windows go to task manager and stop rabbitmq from running...
then reload the rabbitmq-server
For Linux others answered but in Windows you should press Ctrl+Alt+delete and select task management and in that end proccess that depends on erlang.
Note that it requires Administrator previlage.
Now enter this command to start rabbitmq-server:
rabbitmq-server start
Every time you restart your computer you should do these steps.For prevent do them again you should stop rabbitmq service from startup services.
went through same problem in windows, it is already running after installation as a service
so just enable the plugins from the rabbitmq commandline by entering the code as
rabbitmq-plugins enable management_plugin
than go to the localhost:15672 and good to go.
This means that your port 25672 is already in use
try: -
sudo lsof -i :25672
sudo kill <PID>
and now start your rabbitmq server using
sudo rabbitmq-server

React native ERROR Packager can't listen on port 8081

When I run command react-native start, it shows Packager can't listen on port 8081.
I know the issue is about software using my port 8081 .
I use Resource Monitor to see the port, but I can't find 8081, there is no 8081
Can someone show me how to find it?
On a mac, run the following command to find id of the process which is using port 8081
sudo lsof -i :8081
Then run the following to terminate process:
kill -9 23583
Here is how it will look like
You can run the packager on another port.
$ react-native start --port=8088
Alternatively, find out what is using which ports on Windows with netstat.
$ netstat -a -b -o
Netstat gives you a PID, which you can use to kill the process.
$ taskkill /pid 1234
This error is coming because some process is already running on 8081 port. Stop that process and then run your command, it will run your code. For this first list all the process which are using this port by typing
lsof -i :8081
This command will list the process id (PID) of the process and then kill the node process by using
kill -9 <PID>
Here PID is the process id of the node process.
That picture indeed shows that your 8081 is not in use. If suggestions above haven't helped, and your mobile device is connected to your computer via usb (and you have Android 5.0 (Lollipop) or above) you could try:
$ adb reconnect
This is not necessary in most cases, but just in case, let's reset your connection with your mobile and restart adb server. Finally:
$ adb reverse tcp:8081 tcp:8081
So, whenever your mobile device tries to access any port 8081 on itself it will be routed to the 8081 port on your PC.
Or, one could try
$ killall node
Ubuntu/Unix && MacOS
My Metro Bundler was stuck and there were lots of node processes running but I didn't have any other development going on besides react-native, so I ran:
$ killall -9 node
The Metro Bundler is running through node on port 8081 by default, and it can encounter issues sometimes whereby it gets stuck (usually due to pressing CTRL+S in rapid succession with hot reloading on). If you press CTRL+C to kill the react-native run-android process, you will suddenly have a bad time because react-native-run-android will get stuck on :
Scanning folders for symlinks in /home/poop/dev/some-app/node_modules (41ms)
Fix:
$ killall -9 node
$ react-native run-android
Note: if you are developing other apps at the time, killing all the node proceses may interrupt them or any node-based services you have running, so be mindful of the sweeping nature of killall -9. If you aren't running a node-based database or app or you don't mind manually restarting them, then you should be good to go.
The reason I leave this detailed answer on this semi-unrelated question is that mine is a solution to a common semi-related problem that sadly requires 2 steps to fix but luckily only takes 2 steps get back to work.
If you want to surgically remove exactly the Metro Bundler garbage on port 8081, do the steps in the answer from RC_02, which are:
$ sudo lsof -i :8081
$ kill -9 23583
(where 23583 is the process ID)
You should kill all the processes running on port 8081 by kill -9 $(lsof -i:8081)
Take the terminal and type
fuser 8081/tcp
You will get a Process id which is using port 8081
Now kill the process
kill <pid>
Check if there is already a Node server running on your machine and then close it.
Try to run in another port like 3131. Run the command:
react-native run-android --port=3131
This might be because of McAfee using that port.
Doing simple lsof -i 8081 may not show the application and you may have to sudo it.
Do sudo lsof -i 8081 and if this command gives an output you can kill it by using
sudo launchctl remove com.mcafee.agent.macmn. After this start packager again.
There is a chance for running programs on port 8081. If you install McAfee antivirus then it's agent will be running on port 8081. So, We can't use the same for other programs.
First we have to verify that the port 8081 is listening or not.
In Windows,
Open CMD and run the command to check whether any program running on the port 8081.
netstat -ano | findstr 8081
Assume that if you got output something like this,
TCP 0.0.0.0:8081 0.0.0.0:0 LISTENING 5800
Then kill the program with ID 5800 using the following command,
taskkill /pid 5800
In Linux / Mac,
Open terminal and run the command to check whether any program running on the port 8081.
sudo lsof -i :8081
Assume that if you got output something like this,
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 59 root 18u IPv4 609033 0t0 TCP localhost:8081 (LISTEN)
Then kill the program with ID 609033 using the following command,
sudo kill -9 59
Alternatively,
You can also run the packager on another port.
react-native start --port=8088
react-native run-android --port=8088
in my case, internet on emulator is down as there is no wifi signal on emulator. Resetting emulator has worked.
In order to fix this issue, the process I have mentioned below.
Please cancel the current process of“react-native run-android” by CTRL + C or CMD + C
Close metro bundler(terminal) window command line which opened automatically.
Run the command again on terminal, “react-native run-android
First of all, in your device go to Dev. Option -> ADB over Network
after do it:
$ adb connect <your device adb network>
$ react-native run-android
(or run-ios, by the way)
if this has successfully your device has installed app-debug.apk,
open app-debug and go to Dev. Settings -> Debug server host & port for device,
type in your machine's IP address (generally, System preference -> Network), as in the example below < your machine's IP address >:8081 (whihout inequality)
finally, execute the command below
$ react-native start --port=8081
try another ports, and verify that you machine and your device are same network.
For Windows
Open PowerShell and Run as Administrator:
net stop winnat
The Windows NAT Driver service was stopped successfully.
net start winnat
The Windows NAT Driver service was started successfully.
EVD Image
I solved this issue by cleaning my Gradle cache.
Using this command:
cd android
./gradlew clean

rabbitmq refusing to start

I have installed rabbitmq on ubuntu and trying to start it using rabbitmq-server start, however, I'm getting this error:
Activating RabbitMQ plugins ...
0 plugins activated:
node with name "rabbit" already running on "mybox"
diagnostics:
- nodes and their ports on mybox: [{rabbit,38618},
{rabbitmqprelaunch13346,41776}]
- current node: rabbitmqprelaunch13346#mybox
- current node home dir: /var/lib/rabbitmq
- current node cookie hash: 8QRKGluOJOcZ4AAkEdFwQg==
so I try to stop it or restart it using service rabbitmq-server restart but I get the following error: Restarting rabbitmq-server: RabbitMQ is not running
The server's host name hostname -s is mybox.
How do I stop the currently running instance, or at least, how do I manage it? I have no access to it and yet I'm not able to run rabbitmq properly.
Thank you.
Rabbitmq is set to start automatically after it's installed.
I don't think it is configured run with the service command.
To see the status of rabbitmq
sudo rabbitmqctl status
To stop the rabbitmq
sudo rabbitmqctl stop
(Try the status command again to see that it's stopped).
To start it again, the recommended method is
sudo invoke-rc.d rabbitmq-server start
These all work with the vanilla ubuntu install using apt-get
Still not working?
If you've tried unsuccessfully to start or restart rabbitmq, check to see how many processes are running.
ps -ef | grep rabbit
There should be 5 processes running as the user rabbitmq.
If you have more, particularly if they're running as other users (such as root, or your own user) you should stop these processes.
The cleanest way is probably to reboot your machine.
rabbitmq-server refuses to start if the hostname -s value has changed.
The solution suggested here is only for test/development environments.
I had to delete the database to fix it locally.
i.e empty folder /var/lib/rabbitmq (ubuntu) or /usr/local/var/lib/rabbitmq/(mac)
I had similar problem but these suggestions didn't work for me(restart too). When I run rabbitmq-server command, I get a response like that:
$/ rabbitmq-server
BOOT FAILED
===========
Error description:
{error,{cannot_log_to_file,"/var/log/rabbitmq/rabbit#haber01.log",
{error,eacces}}}
....
When I checked permissions of /var/log/rabbitmq/rabbit#haber01.log file, I saw that group has not write permisson for that file. So I gave permission to group with that command:
/var/log/rabbigmq/$ chmod g+w *
then problem has gone!
Maybe this answer help someone.
Seems like the Mnesia database was corrupted. Had to delete it to get sudo service rabbitmq-server start going again !
$ sudo rm -rf /var/lib/rabbitmq/mnesia/
Also make sure that any stray rabbit processes are killed before clearing out
$ ps auxww | grep rabbit | awk '{print $2}' | sudo xargs kill -9
And then
$ sudo service rabbitmq-server start
If you use celery, your queues could reach max size and rabbit won't start because of that. Maybe you wouldn't even able to use rabbitmqctl, so if you can afford to clean the queues, just remove
/var/lib/rabbitmq/mnesia/rabbit#<host>/queues
on unix (look for mnesia DB path on your system).
Be careful: this will remove everything you have in rabbit, so this is a last solution ever.
Have a look what is in the log of the node that you are trying to start. It will be in /var/log/rabbitmq/
It was selinux in my case, rabbit could not bind to its ports.
My brew version of rabbitmq refused to start (after working fine for years without modification by me) too.
$ cat /usr/local/etc/rabbitmq/rabbitmq-env.conf
CONFIG_FILE=/usr/local/etc/rabbitmq/rabbitmq
NODE_IP_ADDRESS=127.0.0.1
NODENAME=rabbit#localhost
RABBITMQ_LOG_BASE=/usr/local/var/log/rabbitmq
I edited out rabbit# on NODENAME and brew services restart rabbitmq started working again.
If the standard stop and start are not working, list the rabbitmq processes that are running using
ps aux | grep rabbitmq
Kill the beam.smp process using
kill -9 {process id}
and start the rabbitmq-server again.

Selenium Server on startup

I'm using Selenium RC in a Ubuntu system.
I want to automate the tests, and I need to start Selenium-server.jar on startup of the machine.
I created seleniumServer.conf in /ect/init/ with:
start on startup
start on runlevel 3
respawn
exec xvfb-run java -jar /home/condde/selenium-server-1.0.3/selenium-server.jar -port 4444
When I reboot the machine, it works fine, the process is running.
But when I execute a test, the result is:
PHPUnit_Framework_Exception: Could not connect to the Selenium RC server.
Any ideas?
Thanks!
I have the same problem, my process can not connect the selenium server sometimes. After dig into debug log and selenium source code, I found that's because java's SecureRandom hangs if /dev/random hangs when selenium try generate random number. So I replace /dev/random with /dev/urandom, then selenium server works fine:
sudo mv /dev/random /dev/random.real
sudo ln -s /dev/urandom /dev/random
Or you can modify $JAVA_HOME/jre/lib/security/java.security file and changing the property:
securerandom.source=file:/dev/random
to:
securerandom.source=file:/dev/urandom
Maybe it works, but not for me.
Use -debug to start Selenium with debug log to see if any error.
java -jar selenium-server.jar -debug > /var/log/selenium-server.log 2>&1
I did this on ubuntu 14 using npm.
First, install the selenium-standalone via npm.
sudo npm install selenium-standalone -g
sudo selenium-standalone install
Then create a symbolic link in /etc/init.d, and configure it to run.
sudo ln -s /usr/local/bin/selenium-standalone /etc/init.d/
sudo update-rc.d selenium-standalone defaults
Another very simple and good solution is to install selenium via docker. I have used the chrome image and it's easy as:
sudo docker run -d -p 4444:4444 selenium/standalone-chrome
The -d option makes is a daemon that will be restarted every time you start your computer. The -p option forwards the webdriver port (4444) from the docker instance to the host.
Well, it's not phantomjs, but I like chrome better anyway. There is also a firefox image! Checkout https://github.com/SeleniumHQ/docker-selenium for more info.
I would start the selenium server process with -log parameter to get info from the process first and all and see if it actually get any kind of connections, errors etc..
A few ideas to troubleshoot:
Do you get any response if you enter http://localhost:4444
It should render a 403 error by the Jetty engine.
If this does not work I would try with your actual IP:4444, that might indicate problem with localhost variable, proxy settings etc..
Could the firewall settings be blocking the the 4444 port? Maybe the Selenium Server process is not allowed to start the browser.