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

[Android] Fix EventLoop issue when commissioner restart #26216

Closed

Conversation

yhoyoon
Copy link
Contributor

@yhoyoon yhoyoon commented Apr 24, 2023

Problem

There is a problem that the EventLoop terminates as soon as it starts when the Android platform-based commissioner is restarted. Restarting commissioner means calling the following methods in order.

  • ChipDeviceController.loadJni()
  • androidPlatform = new AndroidPlatform()
  • chipDeviceController = new ChipDeviceController()
  • ChipDeviceController.shutdownCommissioning()
  • androidPlatform = new AndroidPlatform()
  • chipDeviceController = new ChipDeviceController()

For reference, this commissioner is not implemented as a singleton.

Change overview

mShouldRunEventLoop is set to false by calling "shutdownCommissioning()" method. In this state, to reinitialize the commissioner and restart the EventLoop, call the "new ChipDeviceController()" constructor. The EventLoop then terminates as soon as it starts.
This change sets mShouldRunEventLoop to true when initializing the EventLoop, fixing an issue where the EventLoop terminates as soon as it starts when the commissioner restarts.

Testing

Restart the Android platform-based commissioner.

There is a problem that the EventLoop terminates as soon as it starts
when the Android platform-based commissioner is restarted.
Restarting commissioner means calling the following methods in order.
- ChipDeviceController.loadJni()
- androidPlatform = new AndroidPlatform()
- chipDeviceController = new ChipDeviceController()
- ChipDeviceController.shutdownCommissioning()
- androidPlatform = new AndroidPlatform()
- chipDeviceController = new ChipDeviceController()
For reference, this commissioner is not implemented as a singleton.
mShouldRunEventLoop is set to false by calling "shutdownCommissioning()"
method. In this state, to reinitialize the commissioner and restart the
EventLoop, call the "new ChipDeviceController()" constructor. The
EventLoop then terminates as soon as it starts.
This change sets mShouldRunEventLoop to true when initializing the
EventLoop, fixing an issue where the EventLoop terminates as soon as it
starts when the commissioner restarts.

Signed-off-by: Youngho Yoon <[email protected]>
Signed-off-by: Charles Kim <[email protected]>
Signed-off-by: Hunsup <[email protected]>
Signed-off-by: sanghyukko <[email protected]>
Signed-off-by: Jaehoon You <[email protected]>
Signed-off-by: Kyu-Wook Lim <[email protected]>
@github-actions
Copy link

PR #26216: Size comparison from de0dfcf to 5078f58

Full report (1 build for cc32xx)
platform target config section de0dfcf 5078f58 change % change
cc32xx lock CC3235SF_LAUNCHXL 0 0 0 0.0
(read only) 643249 643249 0 0.0
(read/write) 203848 203848 0 0.0
.ARM.attributes 44 44 0 0.0
.ARM.exidx 8 8 0 0.0
.bss 197248 197248 0 0.0
.comment 194 194 0 0.0
.data 1480 1480 0 0.0
.debug_abbrev 933224 933224 0 0.0
.debug_aranges 87792 87792 0 0.0
.debug_frame 302140 302140 0 0.0
.debug_info 20330829 20330829 0 0.0
.debug_line 2687904 2687904 0 0.0
.debug_loc 2838960 2838960 0 0.0
.debug_ranges 288072 288072 0 0.0
.debug_str 3042335 3042335 0 0.0
.ramVecs 780 780 0 0.0
.resetVecs 64 64 0 0.0
.rodata 104401 104401 0 0.0
.shstrtab 232 232 0 0.0
.stab 204 204 0 0.0
.stabstr 441 441 0 0.0
.stack 2048 2048 0 0.0
.strtab 377963 377963 0 0.0
.symtab 256976 256976 0 0.0
.text 536728 536728 0 0.0

@andy31415
Copy link
Contributor

Seems the same like #26195 however that one has additional logic and a unit test.

@yhoyoon
Copy link
Contributor Author

yhoyoon commented Apr 24, 2023

@andy31415 Thank you, I missed #26195 so I'm closing this PR.

@yhoyoon yhoyoon closed this Apr 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants