race condition in abra app new #64

Closed
opened 2021-09-03 16:08:14 +00:00 by roxxers · 5 comments

There is a race condition when trying to create a new app. Trying the command multiple times leads to either the 21.0.3 is not available? error or the app ignoring all the args and going through the survey dialogue

$ ./abra app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud                                                       
? Select app server: swarm-test.autonomic.zone
? Specify app name: (testnext_swarm-test_autonomic_zone) 
FATA[0016] interrupt
$ ./abra app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud
FATA[0000] 21.0.3 is not available?                     
$ ./abra app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud                                                       FATA[0000] 21.0.3 is not available?                     
$ ./abra app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud                                                       
FATA[0000] 21.0.1 is not available?                     
$ ./abra app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud                                                       
? Select app server:  [Use arrows to move, type to filter]
  lumbung.space
> swarm-test.autonomic.zone
  swarm.autonomic.zone
  swarm.neuronicgames.com
  swarm-demo.autonomic.zone
  centreforthestudyof.net
  mellor.coopcloud.tech
FATA[0005] interrupt                                    
There is a race condition when trying to create a new app. Trying the command multiple times leads to either the `21.0.3 is not available?` error or the app ignoring all the args and going through the survey dialogue ``` $ ./abra app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud ? Select app server: swarm-test.autonomic.zone ? Specify app name: (testnext_swarm-test_autonomic_zone) FATA[0016] interrupt $ ./abra app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud FATA[0000] 21.0.3 is not available? $ ./abra app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud FATA[0000] 21.0.3 is not available? $ ./abra app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud FATA[0000] 21.0.1 is not available? $ ./abra app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud ? Select app server: [Use arrows to move, type to filter] lumbung.space > swarm-test.autonomic.zone swarm.autonomic.zone swarm.neuronicgames.com swarm-demo.autonomic.zone centreforthestudyof.net mellor.coopcloud.tech FATA[0005] interrupt ```
Author

Seems like the version of the app that LatestVersion returns keeps changing (the printed ver it the output of that)

21.0.2_1
? Select app server:  [Use arrows to move, type to filter]
> utaw.autonomic.zone
  yolo.servers.coop
  centreforthestudyof.net
  demo.coopcloud.tech
  jones.iww.org.uk
  swarm-demo.autonomic.zone
  swarm.autonomic.zone
FATA[0001] interrupt                                    
exit status 1
$ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud                                                   
21.0.3
FATA[0000] 21.0.3 is not available?                     
exit status 1
$ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud
21.0.0
? Select app server:  [Use arrows to move, type to filter]
> swarm-demo.autonomic.zone
  swarm.neuronicgames.com
  mellor.coopcloud.tech
  swarm-test.autonomic.zone
  swarm.autonomic.zone
  utaw.autonomic.zone
  lumbung.space
FATA[0001] interrupt                                    
exit status 1
$ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud
21.0.3
FATA[0000] 21.0.3 is not available?                     
exit status 1
$ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud
21.0.3
FATA[0000] 21.0.3 is not available?                     
exit status 1
$ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud
21.0.2
? Select app server:  [Use arrows to move, type to filter]
> lumbung.space
  mellor.coopcloud.tech
  swarm-demo.autonomic.zone
  swarm.autonomic.zone
  swarm.neuronicgames.com
  centreforthestudyof.net
  demo.coopcloud.tech
FATA[0001] interrupt                                    
exit status 1
$ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud
21.0.1
FATA[0000] 21.0.1 is not available?                     
exit status 1
Seems like the version of the app that LatestVersion returns keeps changing (the printed ver it the output of that) ```$ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud 21.0.2_1 ? Select app server: [Use arrows to move, type to filter] > utaw.autonomic.zone yolo.servers.coop centreforthestudyof.net demo.coopcloud.tech jones.iww.org.uk swarm-demo.autonomic.zone swarm.autonomic.zone FATA[0001] interrupt exit status 1 $ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud 21.0.3 FATA[0000] 21.0.3 is not available? exit status 1 $ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud 21.0.0 ? Select app server: [Use arrows to move, type to filter] > swarm-demo.autonomic.zone swarm.neuronicgames.com mellor.coopcloud.tech swarm-test.autonomic.zone swarm.autonomic.zone utaw.autonomic.zone lumbung.space FATA[0001] interrupt exit status 1 $ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud 21.0.3 FATA[0000] 21.0.3 is not available? exit status 1 $ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud 21.0.3 FATA[0000] 21.0.3 is not available? exit status 1 $ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud 21.0.2 ? Select app server: [Use arrows to move, type to filter] > lumbung.space mellor.coopcloud.tech swarm-demo.autonomic.zone swarm.autonomic.zone swarm.neuronicgames.com centreforthestudyof.net demo.coopcloud.tech FATA[0001] interrupt exit status 1 $ go run ./cmd/abra/main.go app new -d testnext.swarm-test.autonomic.zone -S -s swarm-test.autonomic.zone nextcloud 21.0.1 FATA[0000] 21.0.1 is not available? exit status 1 ```
Author

Ah ok found it. b1d4f12e7d/catalogue/catalogue.go (L113)

This function is getting the last item in a map. Maps are unordered in go https://www.geeksforgeeks.org/golang-maps/

I think the confusion lies in the comment in the function. They come in ordered from the JSON but as soon as it becomes a go map it no longer is ordered. Ill write something using tagcmp to fix this and find the biggest version.

I think the only reason I found this is due to the error I'm getting due to the nextcloud version that seems to actually be the latest not being avaliable? Idk if @decentral1se you could help me with that part seperatly

Ah ok found it. https://git.coopcloud.tech/coop-cloud/go-abra/src/commit/b1d4f12e7dab0d9f1c879da5a2c3ea05bb284c00/catalogue/catalogue.go#L113 This function is getting the last item in a map. Maps are unordered in go https://www.geeksforgeeks.org/golang-maps/ I think the confusion lies in the comment in the function. They come in ordered from the JSON but as soon as it becomes a go map it no longer is ordered. Ill write something using tagcmp to fix this and find the biggest version. I think the only reason I found this is due to the error I'm getting due to the nextcloud version that seems to actually be the latest not being avaliable? Idk if @decentral1se you could help me with that part seperatly
Owner

Idk about this race condition but the version issue is in coop-cloud/go-abra#44 and yeah, that is a good one to fix ASAP :) Will look at this soon.

Idk about this race condition but the version issue is in https://git.coopcloud.tech/coop-cloud/go-abra/issues/44 and yeah, that is a good one to fix ASAP :) Will look at this soon.
Author

Idk about this race condition but the version issue is in coop-cloud/go-abra#44 and yeah, that is a good one to fix ASAP :) Will look at this soon.

I assumed race condition at first but yeah its not on looking at it and must have forgot you already knew. Either way I did a patch but did a patch for this. You can check it in #66 cause I want some eyes on ittt

> Idk about this race condition but the version issue is in https://git.coopcloud.tech/coop-cloud/go-abra/issues/44 and yeah, that is a good one to fix ASAP :) Will look at this soon. I assumed race condition at first but yeah its not on looking at it and must have forgot you already knew. Either way I did a patch but did a patch for this. You can check it in #66 cause I want some eyes on ittt
Author

Is dupe of #44

Is dupe of #44
Sign in to join this conversation.
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: toolshed/abra#64
No description provided.