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

Queries with Larger result tables break postgres driver connection #1123

Open
4 tasks
HughKelley opened this issue Mar 23, 2023 · 0 comments
Open
4 tasks

Queries with Larger result tables break postgres driver connection #1123

HughKelley opened this issue Mar 23, 2023 · 0 comments
Labels
pg PostgreSQL driver triage

Comments

@HughKelley
Copy link

HughKelley commented Mar 23, 2023

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

1 using sqltools in VSCode with the postgres/cockroach DB driver run the following queries with the following results

select 1;
-- good

select * from automated.a_full_raw_results limit 5;
-- good

select * from automated.a_full_raw_results limit 5000;
--good

select * from automated.a_full_raw_results limit 50000;
-- noticeably slower but still succeeds

select * from automated.a_full_raw_results limit 500000;
-- this query fails sometimes but not always

select * from automated.a_full_raw_results limit 5000000;
-- this query fails

-- this query limit below 50,000,000 is finally larger than the size of the table
select * from automated.a_full_raw_results limit 50000000;
-- this query fails


select * from automated.a_full_raw_results;
-- this query fails

-- I did run sudo ip link set dev eth0 mtu 1392
-- there is a primary key on the table...
-- eventually last query gives "Error fetching records. Connection got disposed"
-- all the queries above then hang after the unlimited query is run and fails
-- even SELECT 1 returns: "Error fetching records. connection/RunCommandRequest failed with message: Cannot read properties of null (reading 'driver')"

Expected behavior
I have run the last query successfully in the past. It also runs fine in other clients

Desktop (please complete the following information):

  • SQLTools Version 0.27.1
  • VS Code Version: 1.76.2
  • OS: WSL Ubuntu 20.04.5
  • Driver:
    • [X ] PostgreSQL/Redshift
    • MySQL/MariaDB
    • MSSQL/Azure
    • SQLite
    • Other? Which...
  • Database version:
  • PostgreSQL 12.14 (Ubuntu 12.14-0ubuntu0.20.04.1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, 64-bit

Additional context
I believe this is either a sqltools problem or a problem with the sqltools postgres driver because the queries run correctly in other clients, dbeaver, qgis.

Restarting VSCode from WSL with code . is sometimes sufficient to fix the problem. In some cases restarting the WSL process itself is sufficient. I've done full computer reboots but I"m not positive they were necessary.

I would also guess this is somehow related to the table size since it happens with the unlimited query. Table is 7.8 million rows

thank you!

Here is the connection settings being used:

{ "sqltools.connections": [{
            "previewLimit": 50,
            "server": "192.168.80.227",
            "port": 5432,
            "driver": "PostgreSQL",
            "name": "clemson_univ",
            "database": "clemson_univ",
            "username": "u/n",
            "password": "p/w"
        } ]}

Logs copied below in case that's helpful

[1679577042675] INFO  (ls): completion requested {"line":184,"character":43}
    ns: "intellisense"
[1679577050474] INFO  (ext): Connection explorer changed. Will be updated.
    ns: "conn-man:explorer"
[1679577051965] INFO  (ext): Connection explorer changed. Will be updated.
    ns: "conn-man:explorer"
[1679577067208] INFO  (ls): completion requested {"line":189,"character":1}
    ns: "intellisense"
[1679577067297] INFO  (ls): completion requested {"line":189,"character":2}
    ns: "intellisense"
[1679577067303] INFO  (ls): completion requested {"line":189,"character":6}
    ns: "intellisense"
[1679577068434] INFO  (ls): completion requested {"line":189,"character":13}
    ns: "intellisense"

<--- Last few GCs --->

[217:0x61319c0]   253859 ms: Mark-sweep (reduce) 2047.0 (2081.1) -> 2046.4 (2081.6) MB, 685.1 / 0.0 ms  (+ 112.0 ms in 28 steps since start of marking, biggest step 5.0 ms, walltime since start of marking 838 ms) (average mu = 0.333, current mu = 0.056) a[217:0x61319c0]   254906 ms: Mark-sweep (reduce) 2047.4 (2081.6) -> 2047.2 (2082.6) MB, 803.2 / 0.0 ms  (+ 59.4 ms in 15 steps since start of marking, biggest step 4.5 ms, walltime since start of marking 872 ms) (average mu = 0.269, current mu = 0.175) al

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 0xb09980 node::Abort() [/home/hkell/.vscode-server/bin/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/node]
 2: 0xa1c235 node::FatalError(char const*, char const*) [/home/hkell/.vscode-server/bin/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/node]
 3: 0xcf784e v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/home/hkell/.vscode-server/bin/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/node]
 4: 0xcf7bc7 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/home/hkell/.vscode-server/bin/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/node]
 5: 0xeaf465  [/home/hkell/.vscode-server/bin/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/node]
 6: 0xebf12d v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/home/hkell/.vscode-server/bin/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/node]
 7: 0xec1e2e v8::internal::Heap::AllocateRawWithRetryOrFailSlowPath(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/home/hkell/.vscode-server/bin/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/node]
 8: 0xe8336a v8::internal::Factory::NewFillerObject(int, bool, v8::internal::AllocationType, v8::internal::AllocationOrigin) [/home/hkell/.vscode-server/bin/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/node]
 9: 0x11fc0b6 v8::internal::Runtime_AllocateInYoungGeneration(int, unsigned long*, v8::internal::Isolate*) [/home/hkell/.vscode-server/bin/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/node]
10: 0x15f0b19  [/home/hkell/.vscode-server/bin/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/node]
[Info  - 9:11:17 AM] Connection to server got closed. Server will restart.
[1679577077394] ERROR (ext): ERROR: Error fetching records. Connection got disposed., {}
    ns: "error-handler"
[1679577077483] INFO  (ls): SQLTools Server started!
===============================
Using node runtime?: no
ExecPath: /home/hkell/.vscode-server/bin/ee2b180d582a7f601fa6ecfdad8d9fd269ab1884/node 
===============================





-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------

second set of logs after cancelling initial failed query and running SELECT 1;





[1679577199201] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1679577199201] INFO  (ls): REQUEST RECEIVED => connection/ConnectRequest
[1679577199202] ERROR (ls): Connecting error: {"code":1000,"data":{"notification":"LS/driverNotInstalled","dontNotify":true,"args":{"driverName":"PostgreSQL"}}}
    ns: "conn-manager"
[1679577199203] INFO  (ext): Connection explorer changed. Will be updated.
    ns: "conn-man:explorer"
[1679577199204] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1679577199204] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1679577199706] INFO  (ext): EXECUTING COMMAND => sqltools.getConnections
[1679577199707] INFO  (ls): REQUEST RECEIVED => connection/GetConnectionsRequest
[1679577199709] INFO  (ls): REQUEST RECEIVED => connection/RunCommandRequest
[1679577199710] ERROR (ls):
    TypeError: Cannot read properties of null (reading 'driver')
        at migrateConnectionSetting (/home/hkell/.vscode-server/extensions/mtxr.sqltools-0.27.1/dist/languageserver.js:1:709416)
        at exports.getConnectionId (/home/hkell/.vscode-server/extensions/mtxr.sqltools-0.27.1/dist/languageserver.js:1:709497)
        at ConnectionManagerPlugin.getConnectionInstance (/home/hkell/.vscode-server/extensions/mtxr.sqltools-0.27.1/dist/languageserver.js:1:685856)
        at runCommandHandler (/home/hkell/.vscode-server/extensions/mtxr.sqltools-0.27.1/dist/languageserver.js:1:686049)
        at /home/hkell/.vscode-server/extensions/mtxr.sqltools-0.27.1/dist/languageserver.js:1:675452
        at /home/hkell/.vscode-server/extensions/mtxr.sqltools-0.27.1/dist/languageserver.js:1:476996
        at /home/hkell/.vscode-server/extensions/mtxr.sqltools-0.27.1/dist/languageserver.js:1:478745
        at Immediate.<anonymous> (/home/hkell/.vscode-server/extensions/mtxr.sqltools-0.27.1/dist/languageserver.js:1:482602)
        at processImmediate (node:internal/timers:466:21)
[1679577199712] ERROR (ext): ERROR: Error fetching records. Request connection/RunCommandRequest failed with message: Cannot read properties of null (reading 'driver'), {"code":-32603}
    ns: "error-handler"
[1679577213076] INFO  (ls): completion requested {"line":194,"character":7}
    ns: "intellisense"
[1679577213083] INFO  (ls): no active connection completions count: 0
    ns: "intellisense"
[1679577213459] INFO  (ls): completion requested {"line":194,"character":11}
    ns: "intellisense"
[1679577213465] INFO  (ls): no active connection completions count: 0
    ns: "intellisense"
[1679577214443] INFO  (ls): completion requested {"line":194,"character":19}
    ns: "intellisense"
[1679577214449] INFO  (ls): no active connection completions count: 0
    ns: "intellisense"
[1679577215133] INFO  (ls): completion requested {"line":194,"character":25}
@gjsjohnmurray gjsjohnmurray added the pg PostgreSQL driver label Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pg PostgreSQL driver triage
Projects
None yet
Development

No branches or pull requests

2 participants