edgedb / edgedb-cli

The EdgeDB CLI
https://www.edgedb.com/docs/cli/index
Apache License 2.0
165 stars 23 forks source link

OS-level notifications for all local instances when upgrading a single instance to a new version #1054

Open raddevon opened 1 year ago

raddevon commented 1 year ago

When upgrading a local instance to a new server version, I get one OS-level notification that a background item has been added for each instance running on my system. I would expect to get only one for the newly upgraded instance.

Update: I've just noticed that I also get these notifications after restarting my system. I do not get any notifications for other background services, but I get one per EdgeDB instance upon restart. Added this as an alternative reproduction.

image

Steps to Reproduce:

  1. With other instances on the system, upgrade an existing instance to a new version
  2. Observe notifications

or

  1. With instances on the system, restart the computer
  2. Observe notifications
raddevon commented 1 year ago

This is really strange. I just launched UTM (a macOS GUI for QEMU), and I got the same thing — notifications for all of my EdgeDB instances. 🤔

Just closed it and re-launched it, and I didn't get the notifications. Seems it was only on initial launch of UTM.

tailhook commented 1 year ago

I don't see any code that touches other services on upgrade. So probably this is some MacOS bug that shows notifications of all services when one is changed, as confirmed by UTM launch.

Can you also try upgrading an instance after UTM is installed and look whether UTM is also shown in notifications? (i.e. confirm that this is not EdgeDB-specific issue).

raddevon commented 1 year ago

I have only ever seen these "off-topic" notifications referencing the edgedb service although I have quite a few other background services running. Here's a partial list of some non-edgedb services I run: CleanShot 2023-05-30 at 07 19 27@2x

I run close to a dozen non-edgedb services, and I've only ever seen notifications referencing those when installing the associated apps.

tailhook commented 1 year ago

Looks like #1058 should fix it. Would you mind testing it git version? We do rewrite .plist files on stop/start currently. So to test it you can stop and then start your instances (each of them separately, or just some of them to see that there are less notifications). And then do whatever was triggering this notification (i.e. the upgrade of some instance).

raddevon commented 1 year ago

I don't mind testing it. How would I do that? I'm not sure how to run the CLI out of a particular branch.

tailhook commented 1 year ago

If you have Rust installed run in the edgedb-cli repository:

git fetch
git checkout suppress_bg
cargo run -- instance stop -I <inst_name>
cargo run -- instance start -I <inst_name>
cargo run -- instance upgrade --force -I <other_inst_name>

You may also run cargo run --release -- <cli args> to make CLI run faster (at the expense of the slower build).

raddevon commented 1 year ago

This looks great, @tailhook! When I upgraded the instance, I got only the single notification. 🎉

raddevon commented 1 year ago

It appears this didn't fix the issue after all, @tailhook (or else there has been a regression). This morning, I upgraded the CLI and created a new instance. Got a notification for each instance on my machine again.

tailhook commented 1 year ago

Did you upgrade to the nightly? I think we didn't make a stable release.

raddevon commented 1 year ago

I'm on 3.2.0-dev.1003+c9675ed

elprans commented 1 year ago

That might be because this fix only applies to newly created instances, i.e. it does not retroactively apply to all existing service units. IIRC we regenerate unit files on a stop/start cycle, so @raddevon, please try doing that to your old instances and see if the issue persists or not.

raddevon commented 1 year ago

OK, so I would stop/start all of my instances to regenerate all unit files, upgrade the CLI again, and create a new instance? Am I understanding correctly, @elprans?

raddevon commented 1 year ago

It seems this is also happening for instances a user has already destroyed according to a Discord user. See the thread attached to this message: https://discord.com/channels/841451783728529451/849377751370432573/1119215483183452180

tailhook commented 1 year ago

Hm, non-removing service files is weird indeed. Can you try destroying the instance with logging enabled?

RUST_LOG=info edgedb instance destroy -I name

Otherwise, I'll try reproduce it on monday.

tailhook commented 1 year ago

I can't reproduce it myself. Service files are removed as expected on my MacOS 11.2.

mmastrac commented 2 weeks ago

For those seeing the issue, does running sfltool resetbtm from the terminal help? There was an issue with launch agents in Ventura (https://discussions.apple.com/thread/254341579?sortBy=rank) that occasionally shows up with this symptom.