Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NethCTI 3: server does not work properly if some ports are busy during the boot #5451

Closed
alepolidori opened this issue Aug 28, 2018 · 12 comments
Labels
bug A defect of the software nethcti Relative to NethCTI client or server verified All test cases were verified successfully
Milestone

Comments

@alepolidori
Copy link

alepolidori commented Aug 28, 2018

During
On a customer installation, during the boot of the machine, an uncaught exception happens and this cause the break of authentication service (that listen on 50113 port). So the users are not able to login to cti client.

This behavior can happens even if a port is already taken by other service during the boot.

Into the log an "Uncaught exception" is written.

Steps to reproduce

  • I do not find any pattern to reproduce the problem. In testing environment all boot actions work properly.

Expected behavior

After the machine boot, cti server have to work properly.

Actual behavior

In the customer installation clients cannot do the login.

Components

cti server

Fix

Wrap into a try/catch block all local services that listen on a specific port on localhost (in all server files of all com... components). Ports are set into the /etc/nethcti/services.json.

In case of Uncaught exception, thing if a process.exit(1); is correct: upstart will restart the service.

@alepolidori alepolidori added bug A defect of the software nethcti Relative to NethCTI client or server labels Aug 28, 2018
@stale
Copy link

stale bot commented Oct 7, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the invalid It is not valid because of some formal issue, it is a duplicate or a wontfix label Oct 7, 2018
@gsanchietti gsanchietti added this to the NethVoice 14 milestone Oct 9, 2018
@stale stale bot removed the invalid It is not valid because of some formal issue, it is a duplicate or a wontfix label Oct 9, 2018
@alepolidori
Copy link
Author

Some logs related to the problem:

2018-10-24T15:35:08+02:00 - error: [nethcti] UncaughtException !!!
2018-10-24T15:35:08+02:00 - error: [nethcti] Error: connect ECONNREFUSED 127.0.0.1:50113
    at Object.exports._errnoException (util.js:1020:11)
    at exports._exceptionWithHostPort (util.js:1043:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1099:14)
2018-10-24T15:35:08+02:00 - error: [nethcti] UncaughtException !!!
2018-10-24T15:35:08+02:00 - error: [nethcti] Error: socket hang up
    at createHangUpError (_http_client.js:258:15)
    at Socket.socketCloseListener (_http_client.js:290:23)
    at emitOne (events.js:101:20)
    at Socket.emit (events.js:188:7)
    at TCP._handle.close [as _onclose] (net.js:509:12)

@stale
Copy link

stale bot commented Dec 4, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the invalid It is not valid because of some formal issue, it is a duplicate or a wontfix label Dec 4, 2018
@alepolidori alepolidori removed the invalid It is not valid because of some formal issue, it is a duplicate or a wontfix label Dec 6, 2018
@alepolidori
Copy link
Author

alepolidori commented Dec 7, 2018

I've added a shutdown system:

  • when the process is stopped, nethcti server start the shutdown operation
  • all components is responsible to stop its operations and release all resources (in this case is important to release network resources)
  • after all components has been stopped, nethcti-server stop itself after 2 sec (to allow the writing of log entries)
  • if the shutdown process fails, after 8 seconds the nethcti server stop itself in a force manner

alepolidori added a commit to nethesis/nethcti-server that referenced this issue Dec 7, 2018
alepolidori added a commit to nethesis/nethcti-server that referenced this issue Dec 7, 2018
@alepolidori
Copy link
Author

The fix has been applied only to com_authentication_rest component to now.
Evaluate to apply it to other components if needed in the future.

@nethbot
Copy link
Member

nethbot commented Dec 14, 2018

@andrea-marchionni andrea-marchionni added the testing Packages are available from testing repositories label Dec 17, 2018
@alepolidori
Copy link
Author

alepolidori commented Dec 17, 2018

How to test

  • open 2 instances of cti client and login
  • restart the server several times, waiting some seconds from a reboot and the subsequent
  • when the log print the following warning:
2018-12-17T10:56:49+01:00 - warn: [astproxy] asterisk connected
2018-12-17T10:56:49+01:00 - error: [http_proxy] Error: connect ECONNREFUSED 127.0.0.1:50113
    at Object.exports._errnoException (util.js:1020:11)
    at exports._exceptionWithHostPort (util.js:1043:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1099:14)

stop the restart and verify that the authentication component is listening on port 50113 and that the clients successfully login (use netstat -lanp|grep 50113)

@andrea-marchionni andrea-marchionni added verified All test cases were verified successfully and removed testing Packages are available from testing repositories labels Dec 17, 2018
@nethbot
Copy link
Member

nethbot commented Dec 17, 2018

@nethbot
Copy link
Member

nethbot commented Dec 19, 2018

@nethbot
Copy link
Member

nethbot commented Jan 4, 2019

@nethbot
Copy link
Member

nethbot commented Jan 8, 2019

@nethbot
Copy link
Member

nethbot commented Jan 11, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A defect of the software nethcti Relative to NethCTI client or server verified All test cases were verified successfully
Projects
None yet
Development

No branches or pull requests

4 participants