Project

General

Profile

Actions

Task #1367

closed

Change initialization of unix socket

Added by Alex Afanasyev over 10 years ago. Updated over 10 years ago.

Status:
Closed
Priority:
Normal
Category:
Faces
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
3.00 h

Description

Currently, NFD checks if the unix socket file exists and if so simply deletes the file. This causes problems when NFD is run twice (i.e., the second attempt will fail because it will not be able to bind to tcp/udp socket, but will disable any future communication via unix socket).

This task is to change this behavior. Instead of just deleting existing file, the initialization procedure should:

  1. if UNIX socket doesn’t exist, goto step 4
  2. connect to the UNIX socket, if connection succeeds (indicating another process is listening on the same socket), raise an error and abort these steps
  3. delete the UNIX socket
  4. start listening

Related issues 1 (0 open1 closed)

Has duplicate NFD - Bug #1360: producers cannot connect to running nfd if by mistake another instance of nfd is started. ClosedDavide Pesavento03/17/2014

Actions
Actions #1

Updated by Junxiao Shi over 10 years ago

  • Description updated (diff)
  • Category set to Faces
  • Estimated time set to 3.00 h
Actions #2

Updated by Davide Pesavento over 10 years ago

The described procedure is still not race-free. There's a race condition if two nfd processes start up more or less at the same time and no other process is listening on the socket. Usually, an advisory lock such as flock(2) is used on a PID file. Given that you don't want to create a PID file, I believe the same mechanism can be applied to the socket file.

Actions #3

Updated by Junxiao Shi over 10 years ago

This solution is design to solve #1360 where user starts the second instance by mistake. It works as long as time between checking and listening is less than human think time.

Actions #4

Updated by Davide Pesavento over 10 years ago

  • Assignee set to Davide Pesavento
Actions #5

Updated by Alex Afanasyev over 10 years ago

Want to double check. Is this still for version 1?

Actions #6

Updated by Davide Pesavento over 10 years ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 50
Actions #7

Updated by Junxiao Shi over 10 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 50 to 100
Actions

Also available in: Atom PDF