Skip to content

SNOW-3494628: Fix indeterministic error reporting for async job no_result#4221

Open
sfc-gh-mayliu wants to merge 1 commit intomainfrom
SNOW-3494628-fix-asyncjob-noresult
Open

SNOW-3494628: Fix indeterministic error reporting for async job no_result#4221
sfc-gh-mayliu wants to merge 1 commit intomainfrom
SNOW-3494628-fix-asyncjob-noresult

Conversation

@sfc-gh-mayliu
Copy link
Copy Markdown
Collaborator

@sfc-gh-mayliu sfc-gh-mayliu commented May 8, 2026

  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-3494628

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
    • I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: Thread-safe Developer Guidelines
    • If adding any arguments to public Snowpark APIs or creating new public Snowpark APIs, I acknowledge that I have ensured my changes include AST support. Follow the link for more information: AST Support Guidelines
  3. Please describe how your code solves the related issue.

    Please write a short description of how your code change solves the related issue.
    Fix AsyncJob.result("no_result") silently returning None for failed queries. The root cause is a race condition: is_still_running(status) returns False for both SUCCESS and every terminal failure state, and NO_RESULT is the only result type that doesn't trigger the prefetch hook to surface the failure later, so a failure that wasn't visible at the upfront synchronous status check would silently fall through.

Repro steps:

    for i in range(30):
        job = session.sql("select 1/0").collect_nowait()
        try:
            job.result("no_result")
            buckets["silent_none"] += 1
        except Exception:
            buckets["raised"] += 1

Without the fix, silent_none indeterministically returns 6/30 silent failures, exact number varies from run-to-run.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.80%. Comparing base (e8c08d5) to head (5e6407b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4221      +/-   ##
==========================================
- Coverage   95.04%   94.80%   -0.25%     
==========================================
  Files         171      171              
  Lines       43876    43877       +1     
  Branches     7525     7525              
==========================================
- Hits        41701    41596     -105     
- Misses       1368     1435      +67     
- Partials      807      846      +39     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants