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

Error running query: Pending response rejected since connection got disposed (codeQL.runQueryContextEditor) #2973

Closed
Sim4n6 opened this issue Oct 14, 2023 · 16 comments
Assignees
Labels
bug Something isn't working VSCode

Comments

@Sim4n6
Copy link

Sim4n6 commented Oct 14, 2023

Describe the bug

Well, I have a set up as follows:

  • Digital Ocean instance connected using remote SSH VSCode extension.
  • in the instance, there is a a CodeQL cli installed.
  • codeql created a database in the instance.
  • wanna run a query from my machine (client) via Remote SSH VSCode to the instance so that the computation is performed in the DO instance.

Version

  • CodeQL extension version: 1.9.2
    CodeQL CLI version: 2.15.0
    Platform: linux x64

To reproduce

reproduce a similar setup and try to run QL query.

Expected behavior
A clear and concise description of what you expected to happen.
You would get the following error each time

Error running query: Pending response rejected since connection got disposed (codeQL.runQueryContextEditor)

Additional context

I am willing to provide details right away this weekend and the starting of the next week

@Sim4n6 Sim4n6 added the bug Something isn't working label Oct 14, 2023
@Sim4n6
Copy link
Author

Sim4n6 commented Oct 14, 2023

Can this be related to an unstable internet connection?

@charisk
Copy link
Contributor

charisk commented Oct 17, 2023

Hi @Sim4n6, thanks for filing a bug!

Can this be related to an unstable internet connection?

Possibly.. Does the issue come up all the time or is it transient?

I've tested the flow in a Codespace which uses remote host functionality and I was able to run a CodeQL query successfully, but that doesn't exactly replicate your setup

In general, it seems like we have a couple of issues around working with a remote host so I'm not sure of the state of things:

I'll discuss a bit with the team and come back to you.

@charisk charisk self-assigned this Oct 17, 2023
@Sim4n6
Copy link
Author

Sim4n6 commented Oct 17, 2023

Go query was run successfully one time in the remote setup previously mentioned. The ruby query run failed twice.
I thought it was because, during the query running, I fired a local terminal ssh connection to the same instance.... I am still investigating on my side.

@Sim4n6
Copy link
Author

Sim4n6 commented Oct 17, 2023

It is definitely related to some limiting factor either instance CPU overload or instance bandwidth limitation.

Check this case in Github Codespace:

Capture d'écran 2023-10-17 181457

@charisk
Copy link
Contributor

charisk commented Oct 18, 2023

Thanks for the info! It does seem to be related to CPU/bandwidth. Are you running a particularly complex query?

I've tried to reproduce this (using a basic Azure VM) and generally the extension was generally working okay, however at some point I ran a problem query against the linux kernel database and I saw the same error as you. The CPU was at 90+% and the memory reached 100% at some point.

@Sim4n6
Copy link
Author

Sim4n6 commented Oct 18, 2023

The query fails.more often when the source equals any(dataflow node).

@charisk
Copy link
Contributor

charisk commented Oct 19, 2023

@Sim4n6 have you tried running any of these queries locally at all rather than through a remote host?

@Sim4n6
Copy link
Author

Sim4n6 commented Oct 19, 2023

Well, the point of using a remote instance is to circumvent my little laptop perf. The query syntax is correct for sure.

@Sim4n6
Copy link
Author

Sim4n6 commented Oct 19, 2023

I would share the query... In an hour please.

@charisk
Copy link
Contributor

charisk commented Oct 19, 2023

Well, the point of using a remote instance is to circumvent my little laptop perf. The query syntax is correct for sure.

Make sense!

To give you a bit more context, I'm wondering if something specific to the query/database is hitting a CodeQL performance issue/edge case - that will help us clarify whether this is a CodeQL issue or a VS Code extension issue.

I would share the query... In an hour please.

Thank you. If you don't want the query to be public, feel free to DM me in the Security Lab Slack instance.

@Sim4n6
Copy link
Author

Sim4n6 commented Oct 19, 2023

It is this ruby ql query https://github.com/github/codeql/pull/12992/files#diff-8c993937eef8b8df6969f780265e623d0231fa9c9e1d819f0c66ab9ccc984e89

On a database generated from https://github.com/shirasagi/shirasagi commit f249ce3f06f6bfbc0017b38f5c13de424334c3ea

The source is set to any(DataFlow::Node n) and state ...

PS: I remain available for further details.

@MathiasVP
Copy link
Contributor

MathiasVP commented Oct 20, 2023

The source is set to any(DataFlow::Node n) and state ...

That is most likely what's going wrong. Setting your source to be any node in the database will never work on any database larger than a "hello world" project since that will make CodeQL follow dataflow starting at all dataflow nodes in the entire database.

So you need to restrict your isSource somehow. You can read more about how to write a dataflow query at https://codeql.github.com/docs/codeql-language-guides/analyzing-data-flow-in-ruby/#.

@Sim4n6
Copy link
Author

Sim4n6 commented Oct 20, 2023

But on a laptop with 16G RAM, the query works ... I should definitely avoid that use.

@Sim4n6
Copy link
Author

Sim4n6 commented Oct 20, 2023

Thank you very much.

@charisk
Copy link
Contributor

charisk commented Oct 20, 2023

Are you happy for us to close the issue @Sim4n6 ?

@Sim4n6
Copy link
Author

Sim4n6 commented Oct 20, 2023

sure, no problem.

@Sim4n6 Sim4n6 closed this as completed Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working VSCode
Projects
None yet
Development

No branches or pull requests

3 participants