Getting 502 Bad Gateway while executing BigQuery

2,502 views
Skip to first unread message

Rosana Santos

unread,
Mar 9, 2022, 5:10:45 PM3/9/22
to gce-discussion
Hi everyone.
I am getting this error while trying to call insertAll. 


com.google.cloud.bigquery.BigQueryException: 502 Bad Gateway POST https://www.googleapis.com/bigquery/v2/projects/myproject/datasets/mydataset/tables/mytable/insertAll?prettyPrint=false

Libs:

com.google.cloud:google-cloud-bigquery:2.9.3
com.google.http-client:google-http-client:1.41.4
com.google.api-client:google-api-client:1.33.2

More details:

"com.google.cloud.bigquery.BigQueryException: 502 Bad Gateway https://www.googleapis.com/bigquery/v2/projects/myproject/datasets/mydataset/tables/mytable/insertAll?prettyPrint=false <!DOCTYPE html> <html lang=en> <meta charset=utf-8> <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width"> <title>Error 502 (Server Error)!!1</title> <style> ..... </style> <a href=//www.google.com/><span id=logo aria-label=Google></span></a> <p><b>502.</b> <ins>That’s an error.</ins> <p>The server encountered a temporary error and could not complete your request.<p>Please try again in 30 seconds. <ins>That’s all we know.</ins> at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.translate(HttpBigQueryRpc.java:115) at com.google.cloud.bigquery.spi.v2.HttpBigQueryRpc.insertAll(HttpBigQueryRpc.java:494) at com.google.cloud.bigquery.BigQueryImpl.insertAll(BigQueryImpl.java:1074)

Jun (Cloud Platform Support)

unread,
Mar 10, 2022, 3:28:04 PM3/10/22
to gce-discussion
Hey Rosanas, 

Have you re-tried to see if it is working then as per the error you're getting? If you keep getting this error, you shall reach out to the appropriate support channel. 
Notice that Google Groups are reserved for general product discussion, and you shall go to StackOverflow for technical questions or Issue Tracker for product problems and feature requests.
To get a better support you should post to the relevant forum, thus please read the Community Support article for better understanding. 

Rosana Santos

unread,
Mar 11, 2022, 10:48:21 AM3/11/22
to gce-discussion
Hi Jun, thanks for replying to me.
Yes I want.
It's an intermittent error, it starts inserting lines but suddenly this error happens.
I would like to know if there are any updates coming soon or maybe what I could improve on my side.

Best regards,
Rosana

Olu

unread,
Mar 11, 2022, 1:00:18 PM3/11/22
to gce-discussion
502 errors like 500 or 503s may occur for jobs submitted to the BigQuery API, suggest temporary server failures which could be related to network connections, etc. As suggested in this article[0], if this error occurs for jobs.insert calls, we recommend retrying the Job. So, from your side, you can implement some form of retry logic whenever such errors are obtained for your Insert Jobs.

To determine exactly what may have caused the error at the time of your reporting, as suggested earlier, you may have to consult with a GCP Support Engineer to work closely with you on your case.

[0]https://cloud.google.com/bigquery/docs/error-messages#:~:text=about%20data%20consistency.-,jobs.insert%20calls,-If%20you%20receive

Rosana Santos

unread,
Mar 14, 2022, 9:59:15 AM3/14/22
to gce-discussion
Fine.
I meant "I re-tried" when I wrote "Yes I want." in my previous comment. Sorry by the typo.
So, I appreciate your time and I will implement this retry on my side!

All the best,
Rosana

mghaya...@google.com

unread,
Mar 14, 2022, 11:14:53 AM3/14/22
to gce-discussion
Hello Rosana,

In your case I  would suggest you to :

1. Use the latest available driver [1] 2. Setup retry mechanism for queries that fail with 5xx errors. 3. Configure logging on the driver [2] if issue is still observed. [1] - https://storage.googleapis.com/simba-bq-release/jdbc/SimbaJDBCDriverforGoogleBigQuery42_1.2.21.1025.zip [2] - https://storage.googleapis.com/simba-bq-release/jdbc/Simba%20Google%20BigQuery%20JDBC%20Connector%20Install%20and%20Configuration%20Guide.pdf Page 19 - Configure Logging

Reply all
Reply to author
Forward
0 new messages