question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BigQuery: System.OutOfMemoryException thrown when deleting data from large tables

See original GitHub issue

When executing “Delete” queries on large BigQuery tables (100 million+ rows), a System.OutOfMemoryException is being thrown from the BigQuery .NET driver. Occasionally, this will cause the process to terminate unexpectedly instead of throwing an exception.

An example table with this issue has 1.2 billion rows, 26 columns, and 292 GB of data

Environment details

  • OS: Ubuntu 18.04
  • .NET version: .NET Core 2.1.401
  • Package name and version: Google.Cloud.BigQuery.V2 1.3.0-beta05

Steps to reproduce

  1. Create a table with at least 100 million rows of data in BigQuery
  2. Execute the following code:
var credential = GetGoogleCredential();
using (var client = await BigQueryClient.CreateAsync("projectId", credential)) {
   client.ExecuteQuery("DELETE FROM `projectId.dataset.table` WHERE TRUE");
}

Stack Trace

System.AggregateException: One or more errors occurred. —> System.OutOfMemoryException: Exception of type ‘System.OutOfMemoryException’ was thrown. at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding) at System.Text.UTF8Encoding.GetString(Byte[] bytes, Int32 index, Int32 count) at System.Net.Http.HttpContent.ReadBufferAsString(ArraySegment1 buffer, HttpContentHeaders headers) at System.Net.Http.HttpContent.ReadBufferedContentAsString() at System.Net.Http.HttpContent.<>c.<ReadAsStringAsync>b__36_0(HttpContent s) at System.Net.Http.HttpContent.<WaitAndReturnAsync>d__632.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Services.BaseClientService.<DeserializeResponse>d__331.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Google.Apis.Requests.ClientServiceRequest1.<ParseResponse>d__34.MoveNext()

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:12

github_iconTop GitHub Comments

2reactions
jskeetcommented, Dec 11, 2018

I’ll look into exactly what’s going on here. We may need extra overloads for DML scenarios where we only want a row count in the result.

Thanks for the clear report.

0reactions
jskeetcommented, Dec 13, 2018

Great, thanks. I’ll add a test to verify that it’s the case, and add documentation to that effect - as well as raising it with other languages.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Update or Delete over streaming tables fails for BigQuery
A BigQuery job fails to Update/Delete tables in a streaming buffer. The error message thrown is as follows: UPDATE or DELETE statement over...
Read more >
System.OutOfMemoryException when querying large SQL ...
According to http://support.microsoft.com/kb/2874903: This issue occurs because SSMS has insufficient memory to allocate for large results.
Read more >
Resolve Out Of Memory Issues - SQL Server
You can remove non-essential rows from a memory optimized table. The garbage collector returns the memory used by these rows to available memory ......
Read more >
BigQuery Delete Table & Drop Table Commands ...
This article provides a comprehensive understanding on BigQuery Delete Table. It also provides information on BigQuery, its key features and ...
Read more >
SSIS Productivity Pack
Fixed: Google BigQuery Destination component may fail with OutOfMemoryException when batch loads a large set of data. Fixed: Uploading a 0 bytes empty...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found