amule-project / amule

'All-platform' P2P client based on eMule
1.01k stars 222 forks source link

vlc listening on amule's port when closed #172

Open eleius opened 4 years ago

eleius commented 4 years ago

I noticed something strange (and very reproducible) on my system:

  1. download multimedia in amule (amule listens on ip/port 0.0.0.0:XXXX)
  2. use vlc to preview the file in amule
  3. leave vlc open, close amule
  4. now amule refuses to start as vlc is listening on the same ip/port (verified with netstat -plunt)

Any idea what's happening here?

Vollstrecker commented 4 years ago

Are running amule from console, and is it really stopping? I could imagine, that vlc is started as a childprocess, and amule has to wait for it to stop, before it stops itself.

nachtgeist commented 4 years ago

Nope.

As the OP stated: amule is refusing to start due to an already bound port - indeed by VLC. I was pretty surprised to be able to reproduce this:

# netstat -tulpen | grep -e amule -e vlc
tcp        3      0 0.0.0.0:4662            0.0.0.0:*               LISTEN      20114      93843613   26177/vlc           
udp   202752      0 0.0.0.0:4672            0.0.0.0:*                           20114      93843615   26177/vlc           

logfile:

[...]
 2019-12-29 14:30:06: Checking if there is an instance already running...
 2019-12-29 14:30:06: No other instances are running.
!2019-12-29 14:30:17: IO error while reading known.met file: SafeIO::EOF: Attempt to read past end of file.
 2019-12-29 14:30:17: Creditfile loaded, 11698 clients are known
 2019-12-29 14:30:17:  - Credits expired for 1 client!
 2019-12-29 14:30:17: External connections disabled in config file
!2019-12-29 14:30:17: Asio Sockets: CAsioSocketServerImpl bind to 0.0.0.0 4662 failed - Address already in use
!2019-12-29 14:30:17: ERROR: Could not listen to TCP port.
!2019-12-29 14:30:17: Port 4662 is not available. You will be LOWID

I'm guessing wx does something real messy in the background when it's executing the video player command that causes opened ports to bleed into the child process…

Vollstrecker commented 4 years ago

That's why I wanted to see the console-output. There could be some line from vlc, too. Maybe the output of ps -x | grep vlc could help, too.

eleius commented 4 years ago

I'm running amule from its icon in Gnome Shell, but I've just tried it in the console.

2019-12-29 15:03:19: Initialising aMule SVN compiled with wxGTK2 v3.0.4 and Boost 1.69 (Snapshot: rev. 11025) 2019-12-29 15:03:19: Checking if there is an instance already running... 2019-12-29 15:03:19: No other instances are running. 2019-12-29 15:03:19: ListenSocket: Ok. ... VLC media player 3.0.8 Vetinari (revision 3.0.8-0-gf350b6b5a7) [000055755d397660] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface. Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. 2019-12-29 15:04:17: Now, exiting main app... 2019-12-29 15:04:17: aMule OnExit: Terminating core. 2019-12-29 15:04:17: aMule shutdown completed.

After closing amule, ps shows only vlc:

29472 pts/0 Sl 0:00 /usr/bin/vlc /files/shared/test.mp3

and netstat:

tcp 2 0 0.0.0.0:1790 0.0.0.0:* LISTEN 29472/vlc

Finally, when I close vlc this line appear:

QObject::~QObject: Timers cannot be stopped from another thread