CESNET / Netopeer-GUI

Graphical user interface for NETCONF client
MIT License
37 stars 9 forks source link

Segfault error while configuring #98

Closed makramalla closed 7 years ago

makramalla commented 8 years ago

Hello,

After successfully connecting to the NETCONF server and parsing its modules, I receive a segfault error that kills the netopeerguid service and accordingly disconnects the server.

It is also worth mentioning that some of the modules failed to be loaded, which "will be ignored" according to my understanding.

I am running mainly on RedHat 7.1 and also on Ubuntu 14 in which I receive similar results.

The relevant log file is pasted below, and let me know if you need any further information from my end.

Thanks,

Maged

Nov 18 13:10:01 netopeergui systemd: Starting Session 168 of user root. Nov 18 13:10:01 netopeergui systemd: Started Session 168 of user root. Nov 18 13:10:01 netopeergui spice-vdagentd: multiple agents in one session, disabling agent to avoid potential information leak Nov 18 13:10:01 netopeergui spice-vdagentd: multiple agents in one session, disabling agent to avoid potential information leak Nov 18 13:10:01 netopeergui spice-vdagentd: multiple agents in one session, disabling agent to avoid potential information leak Nov 18 13:10:01 netopeergui spice-vdagentd: multiple agents in one session, disabling agent to avoid potential information leak Nov 18 13:10:01 netopeergui spice-vdagentd: multiple agents in one session, disabling agent to avoid potential information leak Nov 18 13:10:25 netopeergui netopeerguid: lib WARNING: Unable to print anydata content (type 8) as JSON. Nov 18 13:10:25 netopeergui kernel: netopeerguid[23666]: segfault at 4800029 ip 00007fea4cdeac35 sp 00007fea48f14b40 error 4 in libyang.so.0.10[7fea4cd77000+be000] Nov 18 13:10:25 netopeergui abrt-hook-ccpp: Saved core dump of pid 23588 (/usr/local/bin/netopeerguid) to /var/tmp/abrt/ccpp-2016-11-18-13:10:25-23588 (23261184 bytes) Nov 18 13:10:25 netopeergui systemd: netopeerguid.service: main process exited, code=killed, status=11/SEGV Nov 18 13:10:25 netopeergui systemd: Unit netopeerguid.service entered failed state. Nov 18 13:10:25 netopeergui abrt-server: Executable '/usr/local/bin/netopeerguid' doesn't belong to any package and ProcessUnpackaged is set to 'no' Nov 18 13:10:25 netopeergui abrt-server: 'post-create' on '/var/tmp/abrt/ccpp-2016-11-18-13:10:25-23588' exited with 1 Nov 18 13:10:25 netopeergui abrt-server: Deleting problem directory '/var/tmp/abrt/ccpp-2016-11-18-13:10:25-23588'

alexadavid commented 8 years ago

Hello, this error belongs to the https://github.com/CESNET/netopeerguid library, @michalvasko should help

michalvasko commented 8 years ago

Hi, please reinstall libnetconf2, all the models should be parsed correctly and no data "should be ignored" anymore. However, I was unable to reproduce the warning you received, what did you do after connecting, or it happened during the session creation? I successfully connected without any errors.

Regards, Michal

makramalla commented 8 years ago

Hello,

I just reinstalled libnetconf2 and libyang and all the data were parsed correctly with no issue.

I am able to successfully connect to the netconf server but I get a different segfault error after I try to connect using the "Configure Device" button on the GUI.

The Errors I receive on the right side of the GUI are: "Empty Response" and "Could not connect to socket. Error: Connection refused"

Here is also the log:

Nov 22 14:46:31 netopeergui kernel: netopeerguid[30947]: segfault at 8 ip 0000000000405cbd sp 00007fc94d841bb0 error 4 in netopeerguid[400000+14000]
Nov 22 14:46:31 netopeergui abrt-hook-ccpp: Saved core dump of pid 30878 (/usr/local/bin/netopeerguid) to /var/tmp/abrt/ccpp-2016-11-22-14:46:31-30878 (32088064 bytes)
Nov 22 14:46:31 netopeergui systemd: netopeerguid.service: main process exited, code=killed, status=11/SEGV
Nov 22 14:46:31 netopeergui systemd: Unit netopeerguid.service entered failed state.
Nov 22 14:46:31 netopeergui abrt-server: Executable '/usr/local/bin/netopeerguid' doesn't belong to any package and ProcessUnpackaged is set to 'no'
Nov 22 14:46:31 netopeergui abrt-server: 'post-create' on '/var/tmp/abrt/ccpp-2016-11-22-14:46:31-30878' exited with 1
Nov 22 14:46:31 netopeergui abrt-server: Deleting problem directory '/var/tmp/abrt/ccpp-2016-11-22-14:46:31-30878'

Let me know if I can provide you with any further information from my end.

Thank you for your help.

Maged

michalvasko commented 8 years ago

Hi Maged, the log says that netopeerguid crashed. I cannot reproduce it and my guess is that there is still something old causing the problem. You can try running the daemon with valgrind and paste here the output, it might provide some insight.

Regards, Michal

makramalla commented 8 years ago

Hi Michal,

I believe that the problem occurs due to libyang's new update.

I decided to recreate Netopeeer-GUI from scratch, and I came across this error in the "make install" step:

Making all in netopeerguid
make[1]: Entering directory `/var/www/Netopeer-GUI/install/netopeerguid'
Making all in src
make[2]: Entering directory `/var/www/Netopeer-GUI/install/netopeerguid/src'
gcc -Wall -Wextra -I/usr/local/include/json-c   -I/usr/local/include    -pthread -O3 -o netopeerguid ./netopeerguid.c ./notification_server.c -L/usr/local/lib -ljson-c   -L/usr/local/lib -lnetconf2   -L/usr/local/lib -lyang   
./netopeerguid.c: In function \u2018node_metadata_ident_recursive\u2019:
./netopeerguid.c:586:30: error: \u2018struct lys_ident\u2019 has no member named \u2018der_size\u2019
         for (i = 0; i < ident->der_size; ++i) {
                              ^
./netopeerguid.c:587:13: error: incompatible type for argument 1 of \u2018node_metadata_ident_recursive\u2019
             node_metadata_ident_recursive(ident->der[i], array);
             ^
./netopeerguid.c:573:1: note: expected \u2018struct lys_ident *\u2019 but argument is of type \u2018struct ly_set\u2019
 node_metadata_ident_recursive(struct lys_ident *ident, json_object *array)
 ^
./netopeerguid.c: In function \u2018libyang_query\u2019:
./netopeerguid.c:2024:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < json_object_array_length(filter_array); ++i) {
                   ^
make[2]: *** [netopeerguid] Error 1
make[2]: Leaving directory `/var/www/Netopeer-GUI/install/netopeerguid/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/var/www/Netopeer-GUI/install/netopeerguid'
make: *** [all-recursive] Error 1

The steps to reproduce on RedHat7.1:

cd /var/www

git clone https://github.com/cesnet/netopeer-gui.git

cd netopeer-gui/install

git clone https://github.com/cesnet/netopeerguid.git

cd netopeerguid

git clone https://github.com/json-c/json-c.git
cd json-c; sh autogen.sh; ./configure; make; make install

cd ../
git clone https://github.com/CESNET/libyang.git 
cd libyang/ ; mkdir build; cd build; cmake ..; make; make install

cd ../../
git clone https://github.com/CESNET/libnetconf2.git
cd libnetconf2; mkdir build; cd build; cmake ..; make; make install

##All other configuration and dependencies are working with no issue

cd /var/www/netopeergui/install

./bootstrap.sh
./configure --without-notifications

make install 

A quick side note: Once I updated libyang and libnetconf2 on the old configuration I created, netopeerguid was still expecting libyang.so.10 although the new libyang library's output is libyang.so.11.

Is there something that I should do differently?

Thanks for your help,

Maged

michalvasko commented 8 years ago

Hi Maged, I forgot to push it, sorry, should be fixed now. Regarding the side note, you need to configure netopeerguid again when any dependency library version changes.

Regards, Michal

makramalla commented 8 years ago

Hello Michal,

Thank you for your help. I was able to overcome the installation error and most of the modules were resolved correctly.

However I got another segfault error:

Nov 25 16:02:20 newnetopeergui kernel: netopeerguid[6923]: segfault at 0 ip 00007f2108e08f70 sp 00007f2104f2bbc0 error 4 in libyang.so.0.11.73[7f2108d93000+c6000]
Nov 25 16:02:20 newnetopeergui abrt-hook-ccpp: Saved core dump of pid 6664 (/usr/local/bin/netopeerguid) to /var/tmp/abrt/ccpp-2016-11-25-16:02:20-6664 (25104384 bytes)
Nov 25 16:02:20 newnetopeergui systemd: netopeerguid.service: main process exited, code=killed, status=11/SEGV
Nov 25 16:02:20 newnetopeergui systemd: Unit netopeerguid.service entered failed state.

I believe that it still has some issues with some of the server's modules. Which is why I tried connecting to a different netconf server.

This time, netopeerguid was not killed but I got a blank page on the browser after I was redirected to http://localhost/netopeer-gui/sections/1/. (after pressing the "Configure Device" button)

These are the log files for the second server's connection attempt:

Nov 25 16:11:00 newnetopeergui netopeerguid: lib WARNING: Invalid position of the key "odu-id" in a list "odu4".
Nov 25 16:11:00 newnetopeergui netopeerguid: lib WARNING: Invalid position of the key "odu-id" in a list "odu4".
Nov 25 16:11:00 newnetopeergui netopeerguid: lib WARNING: Invalid position of the key "odu-id" in a list "odu4".
Nov 25 16:11:00 newnetopeergui netopeerguid: lib WARNING: Invalid position of the key "odu-id" in a list "odu4".
Nov 25 16:11:01 newnetopeergui netopeerguid: Internal: failed to get JSON object "linked-references".
Nov 25 16:11:01 newnetopeergui netopeerguid: Internal: failed to get JSON object "linked-references".
Nov 25 16:11:01 newnetopeergui netopeerguid: Internal: failed to get JSON object "linked-references".
Nov 25 16:11:01 newnetopeergui netopeerguid: Internal: failed to get JSON object "linked-references".
Nov 25 16:11:01 newnetopeergui netopeerguid: Internal: failed to get JSON object "linked-references".

Can you please help me out in resolving this as well? Also let me know what you can conclude from both attempts.

Thank you again so much for your help,

Maged

michalvasko commented 7 years ago

Hi Maged, can you attach all the models you are using? I cannot reproduce this without them.

Regards, Michal

makramalla commented 7 years ago

Hello Michal,

After some debugging from my end I believe that the error occurs while parsing several of the "ietf-snmp" modules. All other modules seam to be parsed successfully. I have attached these files to narrow down the process.

Let me know if this doesn't work and I will attach the other files as well, or if you need anything else from my end.

Thank you again for your help.

Maged

Yang-modules.zip

michalvasko commented 7 years ago

Hi Maged, I do not think that old libnetconf (which netopeer-server uses, which netopeerguid connects to) supports submodules, so that is likely the problem.

Regards, Michal

makramalla commented 7 years ago

Hello Michal,

Thank you for the reply.

Is there any approach that I can use that would allow me to overcome this error and use the GUI inspite of that.

Thanks,

Maged

michalvasko commented 7 years ago

Yes, just remove those ietf-snmp module and its submodules from netopeer-server, should work after that.

Regards, Michal

makramalla commented 7 years ago

Hello,

I removed the ietf-snmp modules along with others that were not able to parse according to the log files in /var/log/messages and it worked!

Se feel free to close this issue.

Thanks again for your help.

Maged