frr icon indicating copy to clipboard operation
frr copied to clipboard

Need a marker or signal for mgmtd config done to avoid "Err: 'Lock already taken on DS by another session!'" issue

Open lipxu opened this issue 2 months ago • 2 comments

Description

There is an issue in SONiC sonic-buildimage repo, https://github.com/sonic-net/sonic-buildimage/issues/23938

When the FRR config file is large, and bgpcfgd starts before mgmtd finishes consuming the initial configurations, it can hit the error: "Err: 'Lock already taken on DS by another session!'"

To prevent this condition, we need a marker or signal from mgmtd to indicate that the mgmtd configuration has completed, so that bgpcfgd can safely proceed to start.

I reviewed the code, and it seems there is currently no such marker. Could you please help double-check this? if not exist, could you please help create one? Thanks a lot.

Version

frr version 10.3

How to reproduce

bgpcfgd starts before mgmtd finishes consuming the initial configurations

Expected behavior

No "Err: 'Lock already taken on DS by another session!'"

Actual behavior

output the error message

Additional context

No response

Checklist

  • [x] I have searched the open issues for this bug.
  • [x] I have not included sensitive information in this report.

lipxu avatar Nov 26 '25 12:11 lipxu

I added this to address this:

sharpd@sharpd-mlt mgmtd % git show ac505e5f45
commit ac505e5f4528f6ce85673e518d1df0c7c10a6ac1
Author: Donald Sharp <[email protected]>
Date:   Fri Jul 11 19:19:15 2025 -0400

    mgmt: Note that a DS is locked or not in output
    
    Modify the `show mgmt datastore ..` command to note
    if the data store is locked and by which session-id.
    
    Signed-off-by: Donald Sharp <[email protected]>

You can backport it and use the command to test( this is what we do in the topotests to ensure that the initial come up is done )

donaldsharp avatar Nov 26 '25 15:11 donaldsharp

I added this to address this:

sharpd@sharpd-mlt mgmtd % git show ac505e5f45
commit ac505e5f4528f6ce85673e518d1df0c7c10a6ac1
Author: Donald Sharp <[email protected]>
Date:   Fri Jul 11 19:19:15 2025 -0400

    mgmt: Note that a DS is locked or not in output
    
    Modify the `show mgmt datastore ..` command to note
    if the data store is locked and by which session-id.
    
    Signed-off-by: Donald Sharp <[email protected]>

You can backport it and use the command to test( this is what we do in the topotests to ensure that the initial come up is done )

Thank you very much @donaldsharp , I will backport it and try it next week. BTW, does this command work during the initial startup stage? Thanks a lot.

lipxu avatar Nov 26 '25 23:11 lipxu