fleet icon indicating copy to clipboard operation
fleet copied to clipboard

sql: no rows in result set modal, when attempting to add a .pkg in Fleet

Open zak-lata opened this issue 1 year ago • 11 comments

Issue only with one specific application.

I was able to add a previous version of the app before, but it no longer will upload. Presented with this error: sql: no rows in result set

Wondering if it has anything to do with it finding a duplicate upload in the S3 Bucket, unsure. Screenshot 2024-08-16 at 10 22 10 AM

zak-lata avatar Aug 16 '24 14:08 zak-lata

hey @zak-lata thanks so much for reaching out!

Issue only with one specific application.

just to confirm my understanding: you were able to upload other .pkg files without problems, is that right? it's just this specific .pkg file?

I was able to add a previous version of the app before, but it no longer will upload. Presented with this error: sql: no rows in result set

I couldn't reproduce this, but I'll keep investigating. Did delete the app using this, and then tried to re-upload?

image

I will dig into the code next and follow up shortly, but that information would be super helpful. Thanks!

roperzh avatar Aug 16 '24 19:08 roperzh

Yep I deleted it.

The app is tailscale

I was testing behaviour to see how Fleet will handle if I was to upload a different version of a similar .pkg

I got the SQL error, so my assumption was I can't have duplicate of the same .pkg name.

Even after deleting the .pkg from fleet, I'm unable to upload anything with Tailscale.

zak-lata avatar Aug 19 '24 15:08 zak-lata

Hi @zak-lata! What's your Fleet version?

lucasmrod avatar Aug 20 '24 13:08 lucasmrod

4.55.0

zak-lata avatar Aug 20 '24 13:08 zak-lata

@zak-lata thank you! can you share if you define any custom pre-install queries, install scripts, or post-install scripts? do you use "self service"

roperzh avatar Aug 20 '24 13:08 roperzh

only thing I did was upload .pkg and checked self service

didn't define anything custom besides the defaults

zak-lata avatar Aug 20 '24 14:08 zak-lata

grabbed the mac os format from: https://tailscale.com/download

installed it on a clean machine

build the .pkg using sudo productbuild --component "path for .app" "path for .pkg"

zak-lata avatar Aug 20 '24 14:08 zak-lata

@zak-lata thank you! this is super helpful

build the .pkg using sudo productbuild --component "path for .app" "path for .pkg"

I'll try this to reproduce now, but if you're able to share that pkg, it would be super appreciated.

Also, if you have time, to inform the product team. Any reason to not use the pkg file directly from https://tailscale.com/download?

roperzh avatar Aug 20 '24 14:08 roperzh

just tried it

download the .pkg, uploaded the .pkg same sql error

zak-lata avatar Aug 20 '24 14:08 zak-lata

@georgekarrv, it looks like Roberto is on this one. I applied MDM label. (return to EOPs if needed)

sharon-fdm avatar Aug 26 '24 18:08 sharon-fdm

Hi @zak-lata , since we are having a hard time reproducing it please go thru the steps on your end again and capture the fleet server logs during the upload and send them our way. thx!

PezHub avatar Aug 28 '24 18:08 PezHub

Please let us know if there is any more information and we can re-open this ticket to continue investigating.

georgekarrv avatar Sep 04 '24 16:09 georgekarrv

Fixing SQL issue, .pkg uploads with ease, Fleet's function increased.

fleet-release avatar Sep 04 '24 16:09 fleet-release

Re-opening this issue as we've received another report of the same behavior. Prioritizing as P1 and will issue a critical patch to correct.

lukeheath avatar Sep 25 '24 21:09 lukeheath

So, I've found a way to repro this for package adds, in my (so far unsuccessful) attempt to repro this for package edits:

  1. Start without a given software title
  2. Upload that software title via GitOps. GitOps doesn't insert bundle ID, so bundle ID and additional ID will be null. You can e.g. use https://ftp.mozilla.org/pub/firefox/releases/129.0.2/mac/en-US/Firefox%20129.0.2.pkg
  3. Remove the installer and re-add (or just add to a different team?) either the same installer or a a new one, e.g. 130.0.1. It will fail with "no rows".

The issue is because we take a different path when adding installers that have a bundle ID than ones where we don't:

https://github.com/fleetdm/fleet/blob/b7e8031b6f95321986a70cf42665124783b00910/server/datastore/mysql/software_installers.go#L176-L181

and in GitOps we never set bundle ID:

https://github.com/fleetdm/fleet/blob/b7e8031b6f95321986a70cf42665124783b00910/server/datastore/mysql/software_installers.go#L773-L781

and there are cases where we might not set it on other software title insertions for apps that we'd expect to have a bundle ID.

Will have to dig a bit more to repro the edit issue we're also seeing, which I'm guessing is related (but not the same, as the above scenario doesn't repro for edit), but the repro for add above is reliable.

Thinking the fix here is to check by both bundle ID and as a fallback check by our normal package criteria. Will need to look a bit to figure out why we're special-casing bundle ID anyway.

iansltx avatar Sep 26 '24 01:09 iansltx

Going to create a quick PR for what I think the fix is for software adds. @roperzh will assign you for review so I don't trigger any regressions here. If the idea is sound we can figure out who fills out the fix.

iansltx avatar Sep 26 '24 05:09 iansltx

Fair warning: the quick fix won't fix the fact that apps that probably should have bundle identifiers for the associated software title won't have them, potentially causing #19144, but this isn't a regression.

iansltx avatar Sep 26 '24 05:09 iansltx

Confirmed that the edit software timeout bug from mozartia is unrelated to this bug, but might as well fix both because on the edit side currently any software uploads that take more than ~20s will fail. I didn't run into this when testing because my internet is too fast to take 20s to transfer even the 500MiB package size limit, but e.g. a 50 Mbps upload connection uploading the current version of Firefox wouldn't complete in time.

Repro for the timeout issue on 4.57.0:

  1. Add a Firefox installer (~160MB)
  2. Throttle connection to 20 Mbps up
  3. Edit Firefox with a package upload (can be the same, but might as well use e.g. a different patch release)
  4. Watch things time out 20s later

iansltx avatar Sep 26 '24 06:09 iansltx

The customer issue is actually slightly different from this I think as the platform in their case is a VPP one. I believe the fix is very similar, just in a different part of the code, but it's not included in my PR yet.

iansltx avatar Sep 26 '24 11:09 iansltx

QA Notes:

Issue 1 - software titles without bundle identifiers throws "sql no rows" error I was able to reproduce for VPP and normal installers on 4.57 but once applying the patch the error no longer displayed upon uploads

Issue 2 - Ensure request timeouts for software installer edits are just as high as for initial software installer uploads tested editing an existing app (Firefox 1.29 --> 1.30) while throttled and can confirm I no longer receive the timeout error within 20s, it waits ~5min which matches our existing threshold for new software uploads

PezHub avatar Sep 26 '24 22:09 PezHub

Software slips through net, In cloud city, no duplicates. Fleet finds a smooth path.

fleet-release avatar Oct 01 '24 00:10 fleet-release

In cloud city's glow, Software uploads once more flow, Fleet ensures smooth grow.

fleet-release avatar Oct 01 '24 14:10 fleet-release