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

SIGABRT when parsing yangdata #2070

Closed
zhuxiaoyun138159 opened this issue Jul 31, 2023 · 1 comment
Closed

SIGABRT when parsing yangdata #2070

zhuxiaoyun138159 opened this issue Jul 31, 2023 · 1 comment
Labels
is:bug Bug description. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...)

Comments

@zhuxiaoyun138159
Copy link
Contributor

zhuxiaoyun138159 commented Jul 31, 2023

YANG:

module ietf-netconf {
  // the namespace for NETCONF XML definitions is unchanged
  // from RFC 4741, which this document replaces
  namespace "urn:ietf:params:xml:ns:netconf:base:1.0";

  prefix nc;

  rc:yang-data yang-errors {
    uses rpc-error;
  }

  grouping rpc-error {
    description
      "A grouping that contains a YANG container
       representing the syntax and semantics of a
       YANG Patch error report within a response message.";

    container rpc-error {
      description
        "An entry containing information about one
          specific error that occurred while processing
          a RESTCONF request.";
      reference
        "RFC 6241, Section 4.3.";

      leaf error-type {
        type enumeration {
          enum transport {
            description
              "The transport layer.";
          }
          enum rpc {
            description
              "The rpc or notification layer.";
          }
          enum protocol {
            description
              "The protocol operation layer.";
          }
          enum application {
            description
              "The server application layer.";
          }
        }
        mandatory true;
        description
          "The protocol layer where the error occurred.";
      }

      leaf error-tag {
        type string;
        mandatory true;
        description
          "The enumerated error-tag.";
      }

      leaf error-severity {
        type string;
        description
          "Contains a string identifying the error severity, as determined by the device.";
      }

      leaf error-app-tag {
        type string;
        description
          "The application-specific error-tag.";
      }

      leaf error-path {
        type string;
        description
          "The YANG instance identifier associated
            with the error node.";
      }

      leaf error-message {
        type string;
        description
          "A message describing the error.";
      }
    }
  }

}

when I use lyd_parse_ext_data parse :

{"ietf-netconf:rpc-error":{"error-type":"application","error-tag":"operation-failed","error-app-tag":"4294967295","error-message":"Error: error test 1","error-path":"/"},"ietf-netconf:rpc-error":{"error-type":"application","error-tag":"operation-failed","error-app-tag":"4294967295","error-message":"Error: error test 2","error-path":"/"}}
Thread 26 "test" received signal SIGABRT, Aborted.
__pthread_kill_implementation (threadid=281472854651168, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
44      pthread_kill.c: No such file or directory.
(gdb) bt
#0  __pthread_kill_implementation (threadid=281472854651168, signo=signo@entry=6, no_tid=no_tid@entry=0) at pthread_kill.c:44
#1  0x0000ffff8d441a14 in __pthread_kill_internal (signo=<optimized out>, threadid=<optimized out>) at pthread_kill.c:78
#2  __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at pthread_kill.c:89
#3  0x0000ffff8d3fa6ac in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x0000ffff8d3fb9a8 in __GI_abort () at abort.c:79
#5  0x0000ffff8d3f3f4c in __assert_fail_base (fmt=0xffff8d516280 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0xffff81a15ff8 "schema", file=file@entry=0xffff81a15e50 "/usr1/libyang/src/tree_data.c", 
    line=line@entry=510, function=function@entry=0xffff81a16a90 <__PRETTY_FUNCTION__.12142> "lyd_insert_get_next_anchor") at assert.c:92
#6  0x0000ffff8d3f3fcc in __GI___assert_fail (assertion=0xffff81a15ff8 "schema", file=0xffff81a15e50 "/usr1/libyang/src/tree_data.c", line=510, function=0xffff81a16a90 <__PRETTY_FUNCTION__.12142> "lyd_insert_get_next_anchor") at assert.c:101
#7  0x0000ffff818f91c0 in lyd_insert_get_next_anchor (first_sibling=0xffff2404fb00, new_node=0xffff2403c020) at /usr1/libyang/src/tree_data.c:510
#8  0x0000ffff818f989c in lyd_insert_node (parent=0x0, first_sibling_p=0xffff8183e0a0, node=0xffff2403c020, last=0 '\000') at /usr1/libyang/src/tree_data.c:662
#9  0x0000ffff81918750 in lydjson_maintain_children (parent=0x0, first_p=0xffff8183e0a0, node_p=0xffff8183de40, last=0 '\000', ext=0x0) at /usr1/libyang/src/parser_json.c:932
#10 0x0000ffff8191a69c in lydjson_subtree_r (lydctx=0xffff241acc70, parent=0x0, first_p=0xffff8183e0a0, parsed=0xffff8183dfb8) at /usr1/libyang/src/parser_json.c:1665
#11 0x0000ffff8191ab94 in lyd_parse_json (ctx=0xffff2c000d80, ext=0xffff2c063418, parent=0x0, first_p=0xffff8183e0a0, in=0xffff240071c0, parse_opts=65536, val_opts=2, int_opts=32, parsed=0xffff8183dfb8, subtree_sibling=0xffff8183dfaf "", 
    lydctx_p=0xffff8183dfc8) at /usr1/libyang/src/parser_json.c:1767
#12 0x0000ffff818f7c38 in lyd_parse (ctx=0xffff2c000d80, ext=0xffff2c063418, parent=0x0, first_p=0xffff8183e0a0, in=0xffff240071c0, format=LYD_JSON, parse_opts=65536, val_opts=2, op=0x0) at /usr1/libyang/src/tree_data.c:128
#13 0x0000ffff818f8084 in lyd_parse_ext_data (ext=0xffff2c063418, parent=0x0, in=0xffff240071c0, format=LYD_JSON, parse_options=65536, validate_options=2, tree=0xffff8183e0a0) at /usr1/libyang/src/tree_data.c:193
@michalvasko
Copy link
Member

Okay, an interesting use-case but the abort should be fixed and now be working correctly.

@michalvasko michalvasko added is:bug Bug description. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...) labels Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:bug Bug description. status:completed From the developer perspective, the issue was solved (bug fixed, question answered,...)
Projects
None yet
Development

No branches or pull requests

2 participants