Hard "Hang" on SOQL Query with ContentVersion.VersionData

Issue #2104 invalid
dennis.wilson created an issue

Appears that any query on ContentVersion.VersionData hangs IntelliJ/IC. I say “hangs” because it is totally unresponsive for 4-5 mins, at which point I kill the application process in order to resume working.

Typical query:

SELECT VersionData FROM ContentVersion WHERE ContentDocumentId = '…' AND IsLatest = TRUE

Another clue: the typical return value for this query should be like:

/services/data/v55.0/sobjects/ContentVersion/0688J00000070jtQAA/VersionData

I’m wondering if the URL-like return value is being interpreted incorrectly – perhaps as a location to redirect to (?)

This issue was previously reported way back in 2017 as #580, but closed by the reporter.

Comments (6)

  1. dennis.wilson reporter

    Realize now the results of query are different when performed from DevConsole. The hang when performing query in IC/QueryEditor was due to large file sizes.

  2. Scott Wells repo owner

    Dennis, was IC2 at least warning you about a potentially long-running query before executing it? It should do so when executing queries that include Blob fields.

    FYI, I just tried the same query and see the following prompt on execution:

    The SOQL query includes Blob fields but does not specify WHERE or LIMIT clauses This can result in very slow query result transfer and processing times. Would you still like the execute it?

  3. dennis.wilson reporter

    Hi Scott:

    Thanks for following up. Your quality of support is unmatched. Hope all is well…

    Just tried again, this time with v2.2.2.0 and the following query on a File (size = 488KB):

    SELECT VersionData FROM ContentVersion WHERE ContentDocumentId = '0698J000000BCy1QAG' AND IsLatest = true
    

    Didn’t see the prompt/warning you describe.

    thanks,
    Dennis

  4. Scott Wells repo owner

    Correct, it wouldn't show a prompt with that query because there's a WHERE clause. Guess I should've noticed that in the original issue summary as well. It only reports such issues with unconstrained queries that include Blob fields. I suppose I could make that prompt optionally show for any query that contains Blob fields even with constraints since even a single row with a Blob seems to cause issues.

  5. Jurgis Salna

    Just nearly hung my IDE with query

    select contentData from contentVersion
    

    That returned 27 files (unsure what size)
    So there’s def some additional precaution that could be added?

  6. Scott Wells repo owner

    Were you not prompted about querying Blob fields?

    If that’s confirmed, unfortunately there’s not a general purpose way to know how large those Blob fields are in the returned result set, so the issue comes up when the SOAP toolkit that’s used to execute the query is trying to deserialize the returned data into in-memory structures.

    It’s possible that there’s some way to inject logic into that deserialization step to look at the data size before trying to push it into an object, but in general the prompt above and its kin are there to warn preemptively that the executed query could cause issues.

  7. Log in to comment