Skip to content

Add temporary FLAKE_DEBUG probe for stagings 404 - #5512

Open
philippthun wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:debug-stagings-404-instrumentation
Open

philippthun wants to merge 1 commit into
cloudfoundry:mainfrom
sap-contributions:debug-stagings-404-instrumentation

Conversation

@philippthun

Copy link
Copy Markdown
Member

The GET /staging/packages/:guid endpoint intermittently returns 404 for a package that was just created in the same request-scoped transaction. The failure is transient and contention-sensitive; it has not reproduced under local stress, so it must be diagnosed from a live CI occurrence.

Add instrumentation that fires only on the nil path. On the controller side, log on the connection the SELECT actually used: whether the row is physically present (raw_match), how many package rows are visible at all (total_count), whether the transaction is still open (in_txn), and the db/connection/thread identity. On the test side, log the same identity for the inserting connection so a swap between insert and read is detectable.

Revert both probes once CI has logged one occurrence.

This change was developed with AI assistance; all code was reviewed and tested by me.

  • I have reviewed the contributing guide

  • I have viewed, signed, and submitted the Contributor License Agreement

  • I have made this pull request to the main branch

  • I have run all the unit tests using bundle exec rake

  • I have run CF Acceptance Tests

The GET /staging/packages/:guid endpoint intermittently returns 404
for a package that was just created in the same request-scoped
transaction. The failure is transient and contention-sensitive; it
has not reproduced under local stress, so it must be diagnosed from a
live CI occurrence.

Add instrumentation that fires only on the nil path. On the controller
side, log on the connection the SELECT actually used: whether the row
is physically present (raw_match), how many package rows are visible
at all (total_count), whether the transaction is still open (in_txn),
and the db/connection/thread identity. On the test side, log the same
identity for the inserting connection so a swap between insert and read
is detectable.

Revert both probes once CI has logged one occurrence.

package = PackageModel.find(guid:)
raise ApiError.new_from_details('NotFound', guid) if package.nil?
if package.nil?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add a 2nd condition here so that this can only run in tests? Maybe some existing rspec env var?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants