edgedb-cli icon indicating copy to clipboard operation
edgedb-cli copied to clipboard

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

Open raddevon opened this issue 1 year ago • 15 comments

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

  • EdgeDB Version: 3.0-rc.1+23c3462
  • EdgeDB CLI Version: EdgeDB CLI 3.1.0-dev.994+eb21ca5
  • OS Version: macOS 13.3.1

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 avatar May 25 '23 19:05 raddevon

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.

raddevon avatar May 26 '23 11:05 raddevon

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).

tailhook avatar May 29 '23 10:05 tailhook

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.

raddevon avatar May 30 '23 11:05 raddevon

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).

tailhook avatar May 31 '23 11:05 tailhook

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.

raddevon avatar May 31 '23 11:05 raddevon

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).

tailhook avatar Jun 01 '23 10:06 tailhook

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

raddevon avatar Jun 02 '23 11:06 raddevon

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.

raddevon avatar Jun 05 '23 13:06 raddevon

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

tailhook avatar Jun 05 '23 15:06 tailhook

I'm on 3.2.0-dev.1003+c9675ed

raddevon avatar Jun 05 '23 15:06 raddevon

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.

elprans avatar Jun 05 '23 18:06 elprans

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 avatar Jun 05 '23 19:06 raddevon

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

raddevon avatar Jun 16 '23 13:06 raddevon

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 avatar Jun 16 '23 15:06 tailhook

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

tailhook avatar Jun 20 '23 11:06 tailhook