logo

Notification

Icon
Error

Options
Go to last post Go to first unread
Offline dima_t  
#1 Posted : Wednesday, September 23, 2015 7:40:13 AM(UTC)
dima_t

Rank: Member

Joined: 9/23/2015(UTC)
Posts: 29

Was thanked: 6 time(s) in 5 post(s)
Hello,


I have complied embedded server SDK opcua_example as is, didn’t change anything except ip address server URI and name.

The weird thing is the random time before actual listener starts. Here is the server output:


2015-09-17 23:18:26.277 - Info: opcua_sdk_366BA0CEEF83431540BF6EE1119D155394E913 F7.cpp, Line: 33

Log string payload: "MatrikonOPC OPC-UA Embedded Server SDK Version 2.1.1"

2015-09-17 23:18:26.277 - Info: opcua_sdk_366BA0CEEF83431540BF6EE1119D155394E913 F7.cpp, Line: 164

Log string payload: "Checking INTERVALS_ARRAY"

2015-09-17 23:18:26.277 - Info: opcua_sdk_366BA0CEEF83431540BF6EE1119D155394E913 F7.cpp, Line: 317

Log string payload: "Checking LOCALES"

2015-09-17 23:18:26.277 - Info: opcua_sdk_366BA0CEEF83431540BF6EE1119D155394E913 F7.cpp, Line: 334

Log string payload: "Checking PROFILE_ARRAY"

2015-09-17 23:18:26.280 - Info: opcua_sdk_B94CFCA5BF59D68F04DBFA3008C11EFC7ECF69 A2.cpp, Line: 27

Log string payload: "PRODUCT_NAME"

2015-09-17 23:18:26.280 - Info: opcua_sdk_B94CFCA5BF59D68F04DBFA3008C11EFC7ECF69 A2.cpp, Line: 28

Log string payload: "SOFTWARE_VERSION"

2015-09-17 23:32:23.447 - Server-socket() is OK...

2015-09-17 23:32:23.447 - Server-setsockopt() is OK...

2015-09-17 23:32:23.447 - Server-bind() is OK...

2015-09-17 23:32:23.447 - Server-listen() is OK...

2015-09-17 23:36:10.528 - Server-accept() is OK...

2015-09-17 23:36:10.528 - 10.36.32.60: New connection on socket 4

2015-09-17 23:36:10.591 - server: UAServer_Callback_close_connection

2015-09-17 23:36:10.591 - Info: opcua_sdk_E564773EFD70F60FF633CF37013CD52BEDC22C



In this case I have 4 minutes delay before server will accept connections.

This gap here:


2015-09-17 23:18:26.280 - Info: opcua_sdk_B94CFCA5BF59D68F04DBFA3008C11EFC7ECF69 A2.cpp, Line: 28

Log string payload: "SOFTWARE_VERSION"

2015-09-17 23:32:23.447 - Server-socket() is OK...



Before I will dig into this may be somebody already knows why this happens?

So, what I am doing wrong? Sometimes it starts immediately, sometimes I have these gaps.



Here is some OS info:

Linux 2.6.32-573.3.1.el6.x86_64

CentOS release 6.7 (Final)

Edited by user Thursday, February 11, 2016 4:32:38 PM(UTC)  | Reason: Not specified

Offline Basavaraju B V  
#2 Posted : Thursday, September 24, 2015 1:30:58 AM(UTC)
Basavaraju B V

Rank: Advanced Member

Joined: 6/10/2015(UTC)
Posts: 34
Location: Bengaluru

Was thanked: 1 time(s) in 1 post(s)
Hi Dima_t,

usually this should not happen. It looks like server application was stuck in Tcpip_run() function. If there is some problem while creating and opening the socket for connection then it will take some time before server can accept the new connection. Can you please use printf() to log each steps with the time stamp till server starts listening to client and post the logs in this forum?

and the OS of the machine where server is running, is it a 64 bit machine or 32 bit machine?

Regards,
Basavaraju B V

Edited by user Thursday, September 24, 2015 3:00:12 AM(UTC)  | Reason: Not specified

Offline dima_t  
#3 Posted : Thursday, October 8, 2015 11:53:31 AM(UTC)
dima_t

Rank: Member

Joined: 9/23/2015(UTC)
Posts: 29

Was thanked: 6 time(s) in 5 post(s)
This line causes the issue.
ua_security_openssl.c : 1682

if (RAND_load_file("/dev/random", NO_RANDOM_BYTES) != NO_RANDOM_BYTES)

My particular machine generates data very slow there and it can wait for 32 bytes for a random amount of time. Problem fixed if I switch to /dev/urandom, that works fast.
Another concern I have is I can forget that I patched it when new version of SDK will be released.
May be the path should be part of the config?

Edited by user Thursday, October 8, 2015 12:30:55 PM(UTC)  | Reason: Not specified

Offline Basavaraju B V  
#4 Posted : Thursday, October 8, 2015 8:11:13 PM(UTC)
Basavaraju B V

Rank: Advanced Member

Joined: 6/10/2015(UTC)
Posts: 34
Location: Bengaluru

Was thanked: 1 time(s) in 1 post(s)
Hi Dima_t,

Good to hear that problem is fixed by replacing /dev/random with /dev/urandom.

Yes, it could be a possible solution to put under the configuration file. But, it is mentioned in the ua_security_openssl.c file that, "application developer has to decide on appropriate source for entropy based on the need".

Note: I have dropped a mail to our architect regarding your concern and I will update once I got the response.I hope that is fine.

Thank you.
Regards,
Basavaraju B V
Offline Basavaraju B V  
#5 Posted : Tuesday, October 13, 2015 2:37:16 AM(UTC)
Basavaraju B V

Rank: Advanced Member

Joined: 6/10/2015(UTC)
Posts: 34
Location: Bengaluru

Was thanked: 1 time(s) in 1 post(s)
Hi Dima_t,

I got the response as,/dev/urandom cannot be added as a part of the server configuration, reason being, it could lead into compromising in security. It is Server developer responsibility to have the good entropy source.

Thank you.

Regards,
Basavaraju B V
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Matrikon Subscribe  |   Matrikon Unsubscribe  |   Global Unsubscribe  |   Privacy Statement  |   Your Privacy Choices   |   Cookie Notice