Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No jobReference when timeout #432

Closed
sunnychow opened this issue Mar 6, 2015 · 18 comments
Closed

No jobReference when timeout #432

sunnychow opened this issue Mar 6, 2015 · 18 comments
Assignees
Labels
api: bigquery Issues related to the BigQuery API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@sunnychow
Copy link

I got the following error when I run a heavy load job which cause a TIMEOUT. Such that the jobComplete is false. And the jobReference is undefined in this case.
https://cloud.google.com/bigquery/querying-data

TypeError: Cannot read property 'jobId' of undefined at responseHandler (.........../node_modules/gcloud/lib/bigquery/index.js:394:43) 
@ryanseys ryanseys added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: bigquery Issues related to the BigQuery API. labels Mar 10, 2015
@stephenplusplus
Copy link
Contributor

Is this fixed in #431?

@sunnychow
Copy link
Author

It's another issues. it's not fixed in #431
I want to ask the response from google bigquery, according to https://cloud.google.com/bigquery/querying-data

If the query timeout expires before the query has finished, the method will return jobComplete=false, and you must call jobs.getQueryResults as described next. The query job will continue to run even after the timeout period until it finishes, either successfully or because an error has occurred.

I have tested on it before, the response does not return the jobReference.jobId. So it cause undefined error in this line https://github.com/GoogleCloudPlatform/gcloud-node/blob/v0.12.0/lib/bigquery/index.js#L394

@stephenplusplus
Copy link
Contributor

Okay, thanks for explaining, and sorry for the delay. I'll take a look at this asap.

@stephenplusplus
Copy link
Contributor

I can't reproduce so far. I ran a query and specified timeoutMs: 0 to force a jobComplete = false. The response from the API returned, as expected, jobComplete = false, but jobReference was always present.

According to the API docs (Search "jobReference": https://cloud.google.com/bigquery/docs/reference/v2/jobs/query):

jobReference: Reference to the Job that was created to run the query. This field will be present even if the original request timed out...

I'm not sure how the response could have come back without that to cause that error. Can you try to reproduce the error using our master branch (npm install --save googlecloudplatform/gcloud-node), and let me know if you still get the error?

@jdcc
Copy link

jdcc commented Apr 21, 2015

Update: Sorry, I see now that this is a different issue with the same symptoms. Move if desired.
I can reproduce on master (b094aa2) with this query:

SELECT
          test_id,
          log_time,
          connection_spec.client_ip,
          connection_spec.server_ip,
          paris_traceroute_hop.src_ip,
          paris_traceroute_hop.dest_ip,
          paris_traceroute_hop.src_hostname,
          paris_traceroute_hop.dest_hostname
        FROM [measurement-lab:m_lab.2014_10]
        WHERE 
          project = 3
          AND connection_spec.client_ip = "62.210.74.143" 
          AND connection_spec.server_ip LIKE '217.163.1.%'
        ORDER BY test_id DESC;

and this code:

bigquery.query(query, function(err, rows, nextQuery) {
  if (nextQuery) {
    bigquery.query(nextQuery, function(err, rows, nextQuery) {});
  }
});

The first query will succeed, and the second will hit this:

TypeError: Cannot read property 'jobId' of undefined at responseHandler (.../gcloud/lib/bigquery/index.js:399:43)

@jdcc
Copy link

jdcc commented Apr 21, 2015

This is what the response object looks like for the second query:

{
kind: 'bigquery#getQueryResultsResponse',
etag: '"uT9StUUc54UCg_Qc3k6xlS99DVE/s-JNbnKyojd-gIIcRpOEggyGqe4"',
jobComplete: false
}

@stephenplusplus stephenplusplus self-assigned this Jun 8, 2015
@stephenplusplus
Copy link
Contributor

Sorry for the slow attention to this issue, @jdcc. I'll be taking another look today to try to get to the bottom of this.

@stephenplusplus
Copy link
Contributor

I'm unfortunately still unable to reproduce. According to the docs and in my experience, a jobReference is always returned. @jdcc or @sunnychow would one of you be able to provide a consistently reproducible query I can run from a query on public data? As an example, something like SELECT url FROM [publicdata:samples.github_nested]. Until then, I'm unfortunately unsure how to resolve.

@gquinones
Copy link

I'm seeing it consistently on my system. With my data, of course. I'll see if I can generate an example with public data. Meantime, could you put a guard in the code to check when this situation occurs and output to the console? At is is, we can't even tell which of the queries is the one that is timing out.

If as you say, this situation has not happened in your experience, then that message will never trigger. No harm, no foul. If, on the other hand, the message does trigger, then we can provide you with more details to help resolve the issue.

The error message I am seeing is:

TypeError: Cannot read property 'jobId' of undefined
    at responseHandler (/usr/local/brightcove/bigquery-metrics/node_modules/gcloud/lib/bigquery/index.js:384:43)
    at /usr/local/brightcove/bigquery-metrics/node_modules/gcloud/lib/common/util.js:672:11
    at Object.handleResp (/usr/local/brightcove/bigquery-metrics/node_modules/gcloud/lib/common/util.js:193:3)
    at Request._callback (/usr/local/brightcove/bigquery-metrics/node_modules/gcloud/lib/common/util.js:667:12)
    at Request.self.callback (/usr/local/brightcove/bigquery-metrics/node_modules/gcloud/node_modules/request/request.js:354:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request.<anonymous> (/usr/local/brightcove/bigquery-metrics/node_modules/gcloud/node_modules/request/request.js:1207:14)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/usr/local/brightcove/bigquery-metrics/node_modules/gcloud/node_modules/request/request.js:1153:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)

@stephenplusplus
Copy link
Contributor

@gquinones I've put up a repo for debugging: stephenplusplus/gcloud-node-bigquery-debug. You can install this with npm in your project to debug:

$ npm install --save stephenplusplus/gcloud-node-bigquery-debug

A new error should come through when this issue appears. You can log and paste the error.response property here to help us see what the API returns.

@jgeewax do you know someone who can help us with this issue? In summary, when calling BigQuery#query, there is evidently sometimes a response from the API (either Jobs.query or Jobs.getQueryResults) that doesn't include jobReference.

According to the JSON API docs, jobReference is guaranteed to exist, but as seen here, it's not coming back.

@gquinones
Copy link

@stephenplusplus Will do.

@gquinones
Copy link

@stephenplusplus Bad news, I'm afraid:

TypeError: undefined is not a function
at responseHandler (/Users/gquinones/work/bigquery-metrics/node_modules/gcloud/lib/bigquery/index.js:389:15)
at /Users/gquinones/work/bigquery-metrics/node_modules/gcloud/lib/common/util.js:684:11
at Object.handleResp (/Users/gquinones/work/bigquery-metrics/node_modules/gcloud/lib/common/util.js:205:3)
at Request._callback (/Users/gquinones/work/bigquery-metrics/node_modules/gcloud/lib/common/util.js:679:12)
at Request.self.callback (/Users/gquinones/work/bigquery-metrics/node_modules/gcloud/node_modules/request/request.js:354:22)
at Request.emit (events.js:98:17)
at Request. (/Users/gquinones/work/bigquery-metrics/node_modules/gcloud/node_modules/request/request.js:1207:14)
at Request.emit (events.js:117:20)
at IncomingMessage. (/Users/gquinones/work/bigquery-metrics/node_modules/gcloud/node_modules/request/request.js:1153:12)
at IncomingMessage.emit (events.js:117:20)

@stephenplusplus
Copy link
Contributor

Sorry, if you un- and re-install my fork, it should be fixed.

@gquinones
Copy link

NP; Will do.

BTW, I'm wondering if the timeout is coming from http and not bigQuery, and therefore the existence guarantee does not apply.

@gquinones
Copy link

@stephenplusplus: Got it!

error: Error encountered for browsers: {"errors":[{}],"message":"API Error: jobReference not returned.","response":{"kind":"bigquery#getQueryResultsResponse","etag":""Gn3Hpo5WaKnpFuT457VBDNMgZBw/BgHAJI-EM7PuCe8xgQX1MgWbQRo"","jobComplete":false}}

@stephenplusplus
Copy link
Contributor

Great, thanks! That appears to be aligned with what @jdcc gets, as well. I think I'll have to defer until @jgeewax can hopefully provide or find us some help.

For now, I've changed the error.response property to be the full request object, including all kinds of details about the http request and response. Feel free to look through there for anything out of the ordinary.

@gquinones
Copy link

@stephenplusplus FYI that the query eventually completed and returned results normally, so the issue is dealing with jobs that are in progress. The jobId is available in the response, just not where it was expected. I pulled it from the response and then used the jobs API to status the job.

The response, edited for brevity was:

An error occurred connecting to Big Query or sending data to graphite for browsers: {"errors":[{}],"message":"API Error: jobReference not returned.","response":{"statusCode":200,"body":"{\n "kind": "bigquery#getQueryResultsResponse",\n "etag": "\"Gn3Hpo5WaKnpFuT457VBDNMgZBw/SVn2n7BA1Kb6sfMPuqUQ3Ix7XNI\"",\n "jobComplete": false\n}\n","headers":{"expires":"Wed, 10 Jun 2015 17:42:01 GMT","date":"Wed, 10 Jun 2015 17:42:01 GMT","cache-control":"private, max-age=0, must-revalidate, no-transform","etag":""Gn3Hpo5WaKnpFuT457VBDNMgZBw/SVn2n7BA1Kb6sfMPuqUQ3Ix7XNI"","vary":"Origin","content-type":"application/json; charset=UTF-8","x-content-type-options":"nosniff","x-frame-options":"SAMEORIGIN","x-xss-protection":"1; mode=block","content-length":"143","server":"GSE","alternate-protocol":"443:quic,p=1"},"request":{"uri":{"protocol":"https:","slashes":true,"auth":null,"host":"www.googleapis.com","port":null,"hostname":"www.googleapis.com","hash":null,"search":"?job[bigQuery][projectId]=rising-ocean-426&job[id]=job_XAZJFpqS5nG62vcKXzPADPTsKH4&query=
SELECT
time_stamp, time, platform, event,
...
","query":"job[bigQuery][projectId]=rising-ocean-426&job[id]=job_XAZJFpqS5nG62vcKXzPADPTsKH4&query=
SELECT
time_stamp, time, platform, event,
…","pathname":"/bigquery/v2/projects/rising-ocean-426/queries/job_XAZJFpqS5nG62vcKXzPADPTsKH4","path":"/bigquery/v2/projects/rising-ocean-426/queries/job_XAZJFpqS5nG62vcKXzPADPTsKH4?job[bigQuery][projectId]=rising-ocean-426&job[id]=job_XAZJFpqS5nG62vcKXzPADPTsKH4&query=
SELECT
time_stamp, time, platform, event,
...","href":"https://www.googleapis.com/bigquery/v2/projects/rising-ocean-426/queries/job_XAZJFpqS5nG62vcKXzPADPTsKH4?job[bigQuery][projectId]=rising-ocean-426&job[id]=job_XAZJFpqS5nG62vcKXzPADPTsKH4&query=
SELECT
time_stamp, time, platform, event,
….
"},"method":"GET","headers":{"Authorization":"Bearer ya29.jgHbYohM_g6PPiPhI_HZZwk-ZmS84vrguYzMEiz29fCRbEnfW2hFru-sKkpse_r9GlJX3PzC76I1bg","User-Agent":"gcloud-node/0.15.0"}}}}

@stephenplusplus
Copy link
Contributor

I was able to reproduce this error as soon as I put my code that works locally up to GCE.

@gquinones could you un- and re-install my fork again? I made some changes that should work around the issue.

sofisl pushed a commit that referenced this issue Nov 10, 2022
sofisl pushed a commit that referenced this issue Nov 11, 2022
…ncy versions (#432)

This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/28f926df-4479-489a-b60f-ecf7782e1eb7/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@fdd03c1
sofisl pushed a commit that referenced this issue Nov 11, 2022
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this issue Nov 11, 2022
sofisl pushed a commit that referenced this issue Nov 11, 2022
fix: use google-gax v3.3.0
Source-Link: googleapis/synthtool@c73d112
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-nodejs:latest@sha256:b15a6f06cc06dcffa11e1bebdf1a74b6775a134aac24a0f86f51ddf728eb373e
sofisl pushed a commit that referenced this issue Nov 11, 2022
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [linkinator](https://togithub.com/JustinBeckwith/linkinator) | [`^2.0.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/linkinator/2.16.2/4.0.0) | [![age](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/compatibility-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/linkinator/4.0.0/confidence-slim/2.16.2)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>JustinBeckwith/linkinator</summary>

### [`v4.0.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v4.0.0)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.1.0...v4.0.0)

##### Features

-   create new release with notes ([#&#8203;508](https://togithub.com/JustinBeckwith/linkinator/issues/508)) ([2cab633](https://togithub.com/JustinBeckwith/linkinator/commit/2cab633c9659eb10794a4bac06f8b0acdc3e2c0c))

##### BREAKING CHANGES

-   The commits in [#&#8203;507](https://togithub.com/JustinBeckwith/linkinator/issues/507) and [#&#8203;506](https://togithub.com/JustinBeckwith/linkinator/issues/506) both had breaking changes.  They included dropping support for Node.js 12.x and updating the CSV export to be streaming, and to use a new way of writing the CSV file.  This is an empty to commit using the `BREAKING CHANGE` format in the commit message to ensure a release is triggered.

### [`v3.1.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.1.0)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.6...v3.1.0)

##### Features

-   allow --skip to be defined multiple times ([#&#8203;399](https://togithub.com/JustinBeckwith/linkinator/issues/399)) ([5ca5a46](https://togithub.com/JustinBeckwith/linkinator/commit/5ca5a461508e688de12e5ae6b4cfb6565f832ebf))

### [`v3.0.6`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.6)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.5...v3.0.6)

##### Bug Fixes

-   **deps:** upgrade node-glob to v8 ([#&#8203;397](https://togithub.com/JustinBeckwith/linkinator/issues/397)) ([d334dc6](https://togithub.com/JustinBeckwith/linkinator/commit/d334dc6734cd7c2b73d7ed3dea0550a6c3072ad5))

### [`v3.0.5`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.5)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.4...v3.0.5)

##### Bug Fixes

-   **deps:** upgrade to htmlparser2 v8.0.1 ([#&#8203;396](https://togithub.com/JustinBeckwith/linkinator/issues/396)) ([ba3b9a8](https://togithub.com/JustinBeckwith/linkinator/commit/ba3b9a8a9b19d39af6ed91790135e833b80c1eb6))

### [`v3.0.4`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.4)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.3...v3.0.4)

##### Bug Fixes

-   **deps:** update dependency gaxios to v5 ([#&#8203;391](https://togithub.com/JustinBeckwith/linkinator/issues/391)) ([48af50e](https://togithub.com/JustinBeckwith/linkinator/commit/48af50e787731204aeb7eff41325c62291311e45))

### [`v3.0.3`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.3)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.2...v3.0.3)

##### Bug Fixes

-   export getConfig from index ([#&#8203;371](https://togithub.com/JustinBeckwith/linkinator/issues/371)) ([0bc0355](https://togithub.com/JustinBeckwith/linkinator/commit/0bc0355c7e2ea457f247e6b52d1577b8c4ecb3a1))

### [`v3.0.2`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.2)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.1...v3.0.2)

##### Bug Fixes

-   allow server root with trailing slash ([#&#8203;370](https://togithub.com/JustinBeckwith/linkinator/issues/370)) ([8adf6b0](https://togithub.com/JustinBeckwith/linkinator/commit/8adf6b025fda250e38461f1cdad40fe08c3b3b7c))

### [`v3.0.1`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.1)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v3.0.0...v3.0.1)

##### Bug Fixes

-   decode path parts in local web server ([#&#8203;369](https://togithub.com/JustinBeckwith/linkinator/issues/369)) ([4696a0c](https://togithub.com/JustinBeckwith/linkinator/commit/4696a0c38c341b178ed815f47371fca955979feb))

### [`v3.0.0`](https://togithub.com/JustinBeckwith/linkinator/releases/tag/v3.0.0)

[Compare Source](https://togithub.com/JustinBeckwith/linkinator/compare/v2.16.2...v3.0.0)

##### Bug Fixes

-   **deps:** update dependency chalk to v5 ([#&#8203;362](https://togithub.com/JustinBeckwith/linkinator/issues/362)) ([4b17a8d](https://togithub.com/JustinBeckwith/linkinator/commit/4b17a8d87b649eaf813428f8ee6955e1d21dae4f))

-   feat!: convert to es modules, drop node 10 ([#&#8203;359](https://togithub.com/JustinBeckwith/linkinator/issues/359)) ([efee299](https://togithub.com/JustinBeckwith/linkinator/commit/efee299ab8a805accef751eecf8538915a4e7783)), closes [#&#8203;359](https://togithub.com/JustinBeckwith/linkinator/issues/359)

##### BREAKING CHANGES

-   this module now requires node.js 12 and above, and has moved to es modules by default.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-talent).
sofisl pushed a commit that referenced this issue Nov 18, 2022
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@types/node](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | [`^14.0.0` -> `^16.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/14.17.32/16.11.6) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/compatibility-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/confidence-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: "after 9am and before 3pm" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-security-center).
sofisl pushed a commit that referenced this issue Jan 24, 2023
sofisl pushed a commit that referenced this issue Jan 25, 2023
sofisl pushed a commit that referenced this issue Sep 14, 2023
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/02b30105-142c-418e-95f6-025914ce48a3/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@5451633
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

6 participants