locka99 / opcua

A client and server implementation of the OPC UA specification written in Rust
Mozilla Public License 2.0
477 stars 129 forks source link

Simple-server failed to parse config #152

Open lsabi opened 2 years ago

lsabi commented 2 years ago

When running the simple-server sample code, I get the following error:

2022-01-09 18:08:18.062 - ERROR - opcua_core::config - Cannot deserialize configuration from ../server.conf

By inspecting the source code, I noticed the following line

https://github.com/locka99/opcua/blob/0.8.1/core/src/config.rs#L42

This line reads the config from a YAML file and not from a config file as the one provided in the samples.

rustup 1.24.3 (ce5817a94 2021-05-31) info: This is the version for the rustup toolchain manager, not the rustc compiler. info: The currently active rustc version is `rustc 1.57.0 (f1edd0429 2021-11-29)

Library version: 0.8.1

AiyionPrime commented 1 week ago

@lsabi I drafted an integration test, which launches the simple-server example and verifies it succeeds parsing its config and binding a port. Is your problem still present in master? Or is this Issue just old?

lsabi commented 1 week ago

Thanks for the tests.

Now, when I run it (on Ubuntu 24.04), I get the error below

opcua/samples/simple-server$ cargo run
2024-07-06 11:30:09.096 ERROR opcua::client::transport::tcp            Could not connect to host 127.0.0.1:4840, Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }
2024-07-06 11:30:10.103 ERROR opcua::client::transport::tcp            Could not connect to host 127.0.0.1:4840, Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }
2024-07-06 11:30:11.106 ERROR opcua::client::transport::tcp            Could not connect to host 127.0.0.1:4840, Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }
2024-07-06 11:30:12.110 ERROR opcua::client::transport::tcp            Could not connect to host 127.0.0.1:4840, Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }
2024-07-06 11:30:13.117 ERROR opcua::client::transport::tcp            Could not connect to host 127.0.0.1:4840, Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }
2024-07-06 11:30:14.121 ERROR opcua::client::transport::tcp            Could not connect to host 127.0.0.1:4840, Os { code: 111, kind: ConnectionRefused, message: "Connection refused" }
AiyionPrime commented 1 week ago

Indeed, that's been confusing me at first as well. The connection that can't be established is not that of a client to the configured server at port 4855, but that to the configured discovery server at 4850 to which the server itself intends to connect. Leaving that configpart out did not appear to be a valid option.

Anyway, what you are seeing is a working client, which is warning in a pretty expressive manner. Maybe we could tone that done a little.

Anyway, just firing up a server and a client in separate terminals might confirm that.