[DAEMON-252] Android: Daemon does not detect addition/deletion of genymotion emulator's immediately
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | High |
Status | Resolved |
Resolution | Fixed |
Resolution Date | 2019-04-01T06:31:45.000+0000 |
Affected Version/s | Appc Daemon 1.1.0, Appc Daemon 1.0.1 |
Fix Version/s | Appc Daemon 2.3.0 |
Components | appcd, appcd-plugin-genymotion |
Labels | n/a |
Reporter | Lokesh Choudhary |
Assignee | Chris Barber |
Created | 2018-04-12T20:17:21.000+0000 |
Updated | 2019-04-01T06:31:45.000+0000 |
Description
Does not appear to be a regression. Seen in 1.0.1 as well.
Steps to reproduce:
1. Add a 2-3 genymotion emulator in the genymotion app. 2. Runappc appcd exec /android/latest/info/emulators
.
3. Repeat the steps after deleting 2-3 genymotion emulators.
Actual result:
1. Appc daemon does not pick up the changes to genymotion immediately for both addition & deletion scenarios but, does after anappc appcd restart
.
This is maybe a dupe of DAEMON-249, reviewing the code of the plugin the changes never got published due to a linting issue (fixed in https://github.com/appcelerator/appcd-plugin-android/pull/12) I will publish 1.1.1 soon
I believe the root of the problem is a race condition. Whenever the VM's config is changed (about 9 times), the code would constantly watch and unwatch the same paths over and over again. This mechanically worked, but I believe pending fs events were never being delivered. Changing the the code to track by path->subscription-id instead of subscription-id->path allows quicker checks to see if the path is already being watched. Note that the Android and iOS plugins will likely suffer from the same problem. I've created DAEMON-253 to investigate. https://github.com/appcelerator/appcd-plugin-genymotion/pull/8
Update: I cannot reproduce this with the latest and greatest code, however there are still underlying issues to address: 1.
@appcd/plugin-android
currently watches theVirtualBox.xml
for changes, then redetects emulators. This does not take into account whether VirtualBox or Genymotion is installed, though this isn't a huge issue as it's only a small amount of wasted resources. The bigger problem@appcd/plugin-android
only detects new VMs, deleted VMs, and renamed VMs. It does not detect property changes such as DPI changes.@appcd/plugin-genymotion
does. It seems silly to copy the logic from@appcd/plugin-genymotion
to@appcd/plugin-android
, but it's completely valid for@appcd/plugin-android
to depend on@appcd/plugin-genymotion
. The proper fix for this ticket would be to remove the fs watching ofVirtualBox.xml
and subscribe to/genymotion/1.x/info/emulators
and use that event to trigger re-detection, which will be cached anyways inandroidlib
. Note that@appcd/plugin-android
needs to properly handle a 404 from/genymotion
should something go wrong, which it shouldn't. 2.@appcd/plugin-android
does unnecessary unsubscribe/resubscribe causing events to slip through the cracks. This is what DAEMON-253 aims to fix.Fixed by https://github.com/appcelerator/appc-daemon-plugins/pull/4.