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

Server crashes during restart #109

Closed
atimin opened this issue Feb 7, 2019 · 9 comments
Closed

Server crashes during restart #109

atimin opened this issue Feb 7, 2019 · 9 comments
Labels
bug Something isn't working

Comments

@atimin
Copy link
Member

atimin commented Feb 7, 2019

If the server restart and there are connected clients, it crushes sometimes with the following message in the log:

19-02-06 15:52:37:381 INFO  [9240] [..\src\servermain.cpp:58]   [2418] accepted new secure channel from client : Address=<127.0.0.1>, Port=<50436>
2019-02-06 15:52:37:388 INFO  [9240] [..\src\servermain.cpp:58]   [2418] accepted new secure channel from client : Address=<127.0.0.1>, Port=<50437>
2019-02-06 15:52:37:394 ERROR [9240] [..\src\servermain.cpp:64]   [2418] receive invalid channel id in OpenSecureChannelRequest : Local-Address=<0.0.0.0>, Local-Port=<48012>, Partner-Address=<127.0.0.1>, Partner-Port=<50436>, ChannelId=<10>
2019-02-06 15:52:37:397 ERROR [9240] [..\src\servermain.cpp:64]   [2418] receive invalid channel id in OpenSecureChannelRequest : Local-Address=<0.0.0.0>, Local-Port=<48012>, Partner-Address=<127.0.0.1>, Partner-Port=<50437>, ChannelId=<12>

Restart sequence:

    opc_server->stop();
    opc_server->shutdown();  

    LOG_INFO("Init Server IO");

    ConfigXml xmlParser;
    xmlParser.parse("OpcUaServer.xml", &conf);

    opc_server->config(conf);

    opc_server->init();
    opc_server->start();

where opc_server is std::shared_ptr<OpcUaStackServer::Server>

OS: Windows 7
Version: 3.6.2

@atimin atimin added the bug Something isn't working label Feb 7, 2019
@huebl
Copy link
Contributor

huebl commented Feb 24, 2019

Error Description:

After restarting the application, the channel should be reopened by the client. The client wants to reuse the previous channel and sends a reconnect open secure channel request. The channel does not exist anymore. Therefore, the server closes the connection. Thereafter, the server accesses the closed socket again.

Error Fixing:
After closing the socket it must not be used anymore,

@huebl
Copy link
Contributor

huebl commented Mar 15, 2019

The error description described above has not been confirmed. Testing with multiple OPC UA clients (Prosys OPC UA Client and UAExpert) did not cause any crashes.

@FLIPBack - Can you provide a CORE dump for this bug?

@huebl
Copy link
Contributor

huebl commented Mar 15, 2019

It could be a problem specific to Windows. The cancel command

  __declspec(deprecated("By default, this function always fails with "
        "operation_not_supported when used on Windows XP, Windows Server 2003, "
        "or earlier. Consult documentation for details."))
#endif
  void cancel()
  {
    boost::system::error_code ec;
    this->get_service().cancel(this->get_implementation(), ec);
    boost::asio::detail::throw_error(ec, "cancel");
  }

The cancel command should be replaced by the close command. Maybe that fixes the bug.

@atimin
Copy link
Member Author

atimin commented Mar 16, 2019

The error description described above has not been confirmed. Testing with multiple OPC UA clients (Prosys OPC UA Client and UAExpert) did not cause any crashes.

@FLIPBack - Can you provide a CORE dump for this bug?

I'll try. Unfortunately the bug's always appearing then I'm focusing on other problem, but when I try it repeat on purpose I've never had success 😕

@atimin
Copy link
Member Author

atimin commented Mar 16, 2019

The cancel command should be replaced by the close command. Maybe that fixes the bug.

Sorry, can't understand where and what I should replace.

@huebl
Copy link
Contributor

huebl commented Mar 16, 2019

You do not have to do anything. I have replaced the cancel command in the Secure Channel with the Close command.

@atimin
Copy link
Member Author

atimin commented Mar 16, 2019

@huebl , I see. If you add Closes #109 into related PR, I'll see in this issue that there is a solution. 😉

@huebl
Copy link
Contributor

huebl commented Mar 16, 2019

I hope so

@atimin
Copy link
Member Author

atimin commented Mar 16, 2019

I hope so

I mean PR's description on GitHub not the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants