lifeline deactivate not work

0 votes
asked Oct 21 in Bug by leiyu

When there is no message before the lifeline activation statement, the deactivation of the same lifeline immediately adjacent to it cannot take effect

below is the code and result:

@startuml
Entity PKG 
Entity MMU
Boundary TDB
Boundary RDB


PKG -> MMU : 1
activate PKG
activate MMU
MMU -> PKG : 2
deactivate MMU
PKG -> TDB : Send Packet
deactivate PKG
activate TDB
deactivate TDB

TDB -> RDB : Send Packet
activate RDB
deactivate RDB
@enduml

as you can see, deactivation of TDB is not work but the deactivation of RDB is work

1 Answer

0 votes
answered Oct 22 by The-Lu (85,440 points)

Hello L.,

Here is a workaround:

@startuml
Entity PKG
Entity MMU
Boundary TDB
Boundary RDB

PKG -> MMU : 1
activate PKG
activate MMU
MMU -> PKG : 2
deactivate MMU
PKG -> TDB : Send Packet
deactivate PKG
activate TDB

TDB -> RDB : Send Packet
deactivate TDB
activate RDB
deactivate RDB
@enduml

And FYI the last `deactivation` is just ignored.

Regards,
Th.

commented Oct 22 by leiyu

Thanks for your answer. I just find I give the wrong example. the correct example code as below:

@startuml
Entity PKG 
Entity MMU
Boundary TDB

Entity IPV
Boundary RDB


PKG -> MMU : 1
activate PKG
activate MMU
MMU -> PKG : 2
deactivate MMU
PKG -> TDB : Send Packet
deactivate PKG
activate TDB

deactivate TDB

RDB -> IPV: Response Packet
activate IPV
activate RDB
deactivate IPV
deactivate RDB
@enduml

but also can solved by move deactivate TDB after activate RDB. but can't set it before activate IPV, which will lead to deactivation of IPV/RDB invalid, code and result as below

@startuml
Entity PKG 
Entity MMU
Boundary TDB

Entity IPV
Boundary RDB


PKG -> MMU : 1
activate PKG
activate MMU
MMU -> PKG : 2
deactivate MMU
PKG -> TDB : Send Packet
deactivate PKG
activate TDB

RDB -> IPV: Response Packet
deactivate TDB
activate IPV
activate RDB
deactivate IPV
deactivate RDB
@enduml

FYI, it seems the bug happens, when a activate command start after a an deactivate, his deactivate follow it without a new message.

Anyway,thanks a lot

leiyu

...