Skip to content

LYB parser fails for mounted-only modules #2634

Open

Description

@pekseow

Summary
When a YANG module exists only in a mounted context (not implemented in the parent context), the LYB data parser fails to parse nodes from that module. The parser incorrectly looks up the module in the parent context before resolving it through the schema-mount extension context.

This breaks change subscribers in sysrepo when an edit touches mounted data, because the event diff is parsed as LYB against the main context.

Affected Component
Component: libyang
File: src/parser_lyb.c
Function: lyb_parse_module() called from LYB_NODE_EXT case

Symptom
Error message during LYB parse:

Invalid context for LYB data parsing, module "<module-name>" not found.

In sysrepo, this manifests as:

  • Publisher: sr_apply_changes() times out after 5 s with "SHM event 'change' ID N processing timed out"
  • Subscriber: Logs Invalid context for LYB data parsing, module "..." not found.

Root Cause
In src/parser_lyb.c, the LYB_NODE_EXT case (line ~1602) calls lyb_parse_module() first. This function does:

  1. ly_ctx_get_module_implemented(pctx->ctx, mod_name) - looks up module in parent context
  2. Checks revision and features against the parent's module

Only afterwards does lyb_parse_schema_ext() resolve the node in the mount context through lys_find_child_node_ext().

For a mounted-only module, step 1 fails because the module doesn't exist in the parent context. Even if the module exists in both contexts, the revision and feature checks compare against the parent's copy instead of the mounted one.

Activity

  1. pekseow commented on Nov 18, 2026

    @pekseow
    Author

    Attached files to reproduce issue with unit test.

    ISSUE-E-REPRODUCTION.md

  2. added a commit that references this issue on Nov 18, 2026
    a0f700b
  3. michalvasko commented on Nov 18, 2026

    @michalvasko
    Member

    Thanks, fixed.

  4. added
    is:bug
    status:completed
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    is:bugstatus:completed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions