Cannot start: predefined port [number] is already in use

Questions about YourKit Java Profiler
Locked
charliek
Posts: 5
Joined: Mon Nov 19, 2018 7:21 pm

Cannot start: predefined port [number] is already in use

Post by charliek »

Hi there,
I'm using YourKit-JavaProfiler-2018.04-b86 and getting an error "Cannot start: predefined port 8763 is already in use". I've tried using few different ports but same error.
Note that this only happens if I want to restrict to certain IP in the listen setting, i.e with "listen=1.2.3.4,port=8763". If I use "listen=all,port=8763", no issues with predefined port already in use error. Also, 1.2.3.4 is just an example for sake of this porting.

Here is the startup setting:
disablestacktelemetry,delay=10000,dir=/home/me/var/tmp,logdir=/home/me/logs/app,sessionname=yourkit,listen=1.2.3.4,port=8763

Trying to see if any process is already using port 8763, but nothing is listening on that port:

[charlesk@bruntfront ~]$ sudo netstat -tulpn | grep LISTEN
Touch Yubikey:
tcp 0 0 127.0.0.1:808 0.0.0.0:* LISTEN 19255/**
tcp 0 0 127.0.0.1:809 0.0.0.0:* LISTEN 19255/**
tcp 0 0 0.0.0.0:2222 0.0.0.0:* LISTEN 1478/sshd-2222
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 19255/**
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1495/sshd
tcp 0 0 :::2222 :::* LISTEN 1478/sshd-2222
tcp 0 0 :::22

Here is the error message from yourkit:

18.04-86 0.703: setTriggers: to unregister: 0
18.04-86 0.703: setTriggers: method listeners to register: 0
18.04-86 0.703: setTriggers: OK
18.04-86 0.703: ourUnsafe: true
18.04-86 0.703: shmem 42341490: OK
18.04-86 0.704: shmem 4234148E: OK
18.04-86 0.732: Cannot start: predefined port 8763 is already in use
18.04-86 0.732: agentInit: Core.init() called
18.04-86 0.732: error: agentInit: Core.init() returned false
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Cannot start: predefined port [number] is already in use

Post by Anton Katilin »

Hi,

We cannot reproduce the problem. Could you please send the full agent log file to [email protected]

Does it work with "listen=localhost,port=8763"?

Please check that 1.2.3.4 is correct. It should be the IP of one of the machine's network interfaces.
charliek
Posts: 5
Joined: Mon Nov 19, 2018 7:21 pm

Re: Cannot start: predefined port [number] is already in use

Post by charliek »

Yes, it seems to start up with "listen=localhost,port=8763"

18.04-86 0.561: YourKit Java Profiler agent is listening on port 8763, "listen=localhost"
18.04-86 0.562: *** HINT ***: To get profiling results, connect to the application from the profiler UI
18.04-86 0.562: agentInit: Core.init() called
18.04-86 0.566: agentInit: OK
18.04-86 0.566: vmInit: 3
18.04-86 0.566: onStartProfiling: entering...
18.04-86 0.566: onStartProfiling: done
18.04-86 0.566: vmInit: OK

Quick question on the listen setting. Is that suppose to used for limiting access to the agent based on an IP address? i.e I want to limit the access to single IP address from my Mac for example.

I'll get the full agent log sent to [email protected] with title "Cannot start: predefined port [number] is already in use"
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Cannot start: predefined port [number] is already in use

Post by Anton Katilin »

Quick question on the listen setting. Is that suppose to used for limiting access to the agent based on an IP address? i.e I want to limit the access to single IP address from my Mac for example.
Absolutely not. It's not the address from which you listen, but the address on which you listen. This option makes sense if the machine has multiple network interfaces (network cards), and you want to bound the connection to particular one.
charliek
Posts: 5
Joined: Mon Nov 19, 2018 7:21 pm

Re: Cannot start: predefined port [number] is already in use

Post by charliek »

Absolutely not. It's not the address from which you listen, but the address on which you listen. This option makes sense if the machine has multiple network interfaces (network cards), and you want to bound the connection to particular one.
Ah I see. So I was misinterpreting that setting.
So, connecting from remote machine is only available through SSH unless listen=all is used right?
charliek
Posts: 5
Joined: Mon Nov 19, 2018 7:21 pm

Re: Cannot start: predefined port [number] is already in use

Post by charliek »

Okay so, removed the listen setting as well as the port and then, configured SSH tunnel and that seems to start the agent. However, when I try to connect to the agent using the UI, I see the status "All applications are hidden" It seems like I'm able to connect but something else is missing?

I'm running the oracle jdk:

Code: Select all

[charlesk@bruntfront ~]$ java -version
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)

Code: Select all

8.04-86 0.571: socket timeout: 30000
18.04-86 0.572: YourKit Java Profiler agent is listening on port 10001, "listen=localhost"
18.04-86 0.572: *** HINT ***: To get profiling results, connect to the application from the profiler UI
18.04-86 0.572: agentInit: Core.init() called
18.04-86 0.580: agentInit: OK
charliek
Posts: 5
Joined: Mon Nov 19, 2018 7:21 pm

Re: Cannot start: predefined port [number] is already in use

Post by charliek »

"All applications are hidden"
I had to uncheck "Hide develpment tools, e.g. IDEs"
I think this is due to setting the startup option with sessionname=yourkit :roll:
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: Cannot start: predefined port [number] is already in use

Post by Anton Katilin »

What is the full command line? Could you please send it to [email protected] and we'll check the development tool detection heuristics.
ashuss
Posts: 2
Joined: Wed Nov 08, 2023 1:11 pm

Re: Cannot start: predefined port [number] is already in use

Post by ashuss »

Hi all, I have the same error on YourKit Java Profiler 2019.8-b127. Was the fix to change it to "listen=localhost"
I currently have it set to "listen=All"
Vladimir Kondratyev
Posts: 1624
Joined: Tue Aug 10, 2004 7:52 pm

Re: Cannot start: predefined port [number] is already in use

Post by Vladimir Kondratyev »

Version 2019.8-b127 is end-of-life. Please use latest profiler version https://www.yourkit.com/java/profiler/download/ The problem is fixed there.

Best regards,
Vladimir Kondratyev
YourKit GmbH
http://www.yourkit.com
"Don't get lost in data, get information!"
ashuss
Posts: 2
Joined: Wed Nov 08, 2023 1:11 pm

Re: Cannot start: predefined port [number] is already in use

Post by ashuss »

Thanks, ill give that a try
Locked