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

powermand: device_tcp.c:266: tcp_disconnect: Assertion `dev->magic == DEV_MAGIC' failed #106

Closed
garlick opened this issue Jan 29, 2024 · 1 comment · Fixed by #118
Closed

Comments

@garlick
Copy link
Member

garlick commented Jan 29, 2024

Problem: powermand hits an assertion failure on exit when connected to a remote tcp device.

$ cd t
$ ./t0004-status-query.t
...
ok 20 - powerman -Q t[3-5] works

expecting success: 
	kill -15 $(cat powermand3.pid) &&
	wait &&
	wait

powermand: device_tcp.c:266: tcp_disconnect: Assertion `dev->magic == DEV_MAGIC' failed.
ok 21 - stop powerman daemon and device server

# passed all 21 test(s)
1..21

Also, not sure why the shell wait isn't failing (one waits for powermand, one waits for vpcd)

@garlick
Copy link
Member Author

garlick commented Feb 4, 2024

(gdb) bt -full
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
        set = {__val = {16384, 138098613416, 366687139504, 266, 1000000, 549459906432, 549459906432, 549459906384, 18446743528248704976, 
            366687030208, 549683298304, 367516891248, 8958396781178301440, 549459906096, 138097527364, 138098902176}}
        pid = <optimized out>
        tid = <optimized out>
        ret = <optimized out>
#1  0x0000002027410aa0 in __GI_abort () at abort.c:79
        save_stage = 1
        act = {__sigaction_handler = {sa_handler = 0x6166202773256020, sa_sigaction = 0x6166202773256020}, sa_mask = {__val = {7936761112679509097, 
              549459906448, 138097579124, 138097213440, 366687136824, 138098613416, 366687139504, 266, 1000000, 138098902176, 138098886192, 
              4616194021471028225, 4616194021471028225, 549459906448, 138097579000, 549459906448}}, sa_flags = 658625652, 
          sa_restorer = 0x2027519ca8}
        sigs = {__val = {32, 0 <repeats 15 times>}}
#2  0x000000202741d478 in __assert_fail_base (fmt=0x2027519ca8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", 
    assertion=assertion@entry=0x556041ac38 "dev->magic == DEV_MAGIC", file=file@entry=0x556041b6b0 "device_tcp.c", line=line@entry=266, 
    function=function@entry=0x556041bc70 <__PRETTY_FUNCTION__.2> "tcp_disconnect") at assert.c:92
        str = 0x5591b6b870 "P\t\267\221U"
        total = 4096
#3  0x000000202741d4dc in __GI___assert_fail (assertion=assertion@entry=0x556041ac38 "dev->magic == DEV_MAGIC", 
    file=file@entry=0x556041b6b0 "device_tcp.c", line=line@entry=266, function=function@entry=0x556041bc70 <__PRETTY_FUNCTION__.2> "tcp_disconnect")
    at assert.c:101
No locals.
#4  0x0000005560408bac in tcp_disconnect (dev=0x5591b50e48) at device_tcp.c:266
        tcp = <optimized out>
        __PRETTY_FUNCTION__ = "tcp_disconnect"
#5  0x0000005560405b60 in dev_destroy (dev=0x5591b50e48) at device.c:1312
        i = <optimized out>
        __PRETTY_FUNCTION__ = "dev_destroy"
#6  0x00000055604126fc in list_destroy (l=0x5591b4b2d0) at list.c:253
        i = <optimized out>
        iTmp = <optimized out>
        p = 0x5591b6a740
        pTmp = 0x0
        __PRETTY_FUNCTION__ = "list_destroy"
#7  0x000000556040653c in dev_fini () at device.c:306
No locals.
#8  0x000000556040d9a4 in _exit_handler (signum=<optimized out>) at powermand.c:207
No locals.

garlick added a commit to garlick/powerman that referenced this issue Feb 4, 2024
Problem: an assertion failure is seen when powermand tears
down with a tcp-connected device:

powermand: device_tcp.c:266: tcp_disconnect:
  Assertion `dev->magic == DEV_MAGIC' failed.

This is because dev_destroy sets dev->magic = 0 before it calls
dev->disconnect.  When dev->disconnect points to tcp_disconnect()
the assertion triggers.

Fixes chaos#106
garlick added a commit to garlick/powerman that referenced this issue Feb 4, 2024
Problem: an assertion failure is seen when powermand tears
down with a tcp-connected device:

powermand: device_tcp.c:266: tcp_disconnect:
  Assertion `dev->magic == DEV_MAGIC' failed.

This is because dev_destroy sets dev->magic = 0 before it calls
dev->disconnect.  When dev->disconnect points to tcp_disconnect()
the assertion triggers.

Fixes chaos#106
@mergify mergify bot closed this as completed in #118 Feb 4, 2024
chu11 pushed a commit to chu11/powerman that referenced this issue Apr 4, 2024
Problem: an assertion failure is seen when powermand tears
down with a tcp-connected device:

powermand: device_tcp.c:266: tcp_disconnect:
  Assertion `dev->magic == DEV_MAGIC' failed.

This is because dev_destroy sets dev->magic = 0 before it calls
dev->disconnect.  When dev->disconnect points to tcp_disconnect()
the assertion triggers.

Fixes chaos#106
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant