Skip to content

🐛 use 32bit integers for threadid in protocol layer #761

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

Merged
merged 67 commits into from
Feb 12, 2018

Conversation

DonJayamanne
Copy link

Fixes #760

octref and others added 30 commits November 3, 2017 13:11
* 'master' of https://github.com/Microsoft/vscode-python:
  Fixes #56 list all environments (#219)
  Fixes #57 Disable activation on debugging (#220)
  Fixes #26 Do not run linters when linters are disabled (#222)
* upstream/master:
  Fix typo in README.md (#252)
  Disable linter without workspaces (#241)
* upstream/master:
  Fix feedback service (#246)
  Fix django context initializer (#248)
  disable generation of tags file upon extension load (#264)
* upstream/master:
  Resolve pythonPath before comparing it to shebang (#273)
* upstream/master:
  Fixes #22 to Detect anaconda from known locations  (#221)
  Use workspaceFolder token instead of workspaceRoot (#267)
  Fix registry lookup response (#224)
  Fix issues when running without debugging and debugged code terminates (#249)
* upstream/master:
  Fix debugging tests (#304)
* upstream/master:
  Remove jupyter functionality in favor of Jupyter extension (#302)
  Drop Python 2 URLs (#307)
* upstream/master:
  Remove setting python.formatting.formatOnSave in favor of the vs code setting (#312)
* upstream/master:
  Remove setting linting.lintOnTextChange as it was never implemented (#315)
* upstream/master:
  Fix travis build error (#326)
* upstream/master:
  add new npm deps with improved gulp for dev (#328)
* upstream/master:
  Update version of inversify package (#329)
* upstream/master:
  Document our dev process (#330)
* upstream/master:
  Document contribution to the code along with coding standards (#321)
* upstream/master:
  Add Simplified Chinese translation of commands (#240)
* upstream/master:
  Fix package.json (#347)
* upstream/master:
  #34, #110 - suppress Intellisense in strings and comments (#339)
  Re-factor code python execution framework  (#345)
* upstream/master:
  Fix linters to make use of the new python code execution framework (#360)
  Update the versioning scheme (#356)
  Make npm happy in regards to line endings (#357)
* upstream/master:
  Ensure python path is not set if already set in user settings (#369)
  Use 'an' rather than 'a' before vowel words (#373)
* upstream/master:
  Use new environment variable parser (#362)
* upstream/master:
  Add `pudb` set trace statement to snippets (#370)
* upstream/master:
  Fix auto-indent regex rules (#562)
  Fix linter installation (#557)
  Upload buillds to azure (#534)
  Delete package-lock.json file (#550)
  Fix exception reported in #447 (#536)
* upstream/master:
  Move badges to the official location within package.json (#587)
  Update contributing guide to mention our monthly release cycle (#567)
  Move issue template to the .github directory (#566)
* upstream/master:
  Added unit test attaching a debugger (#597)
  Add delay for exec in terminal (#592)
  Update TPN for opn and arch (#600)
  Clean build output (#595)
  import specific parts of rxjs to speed up loading (#596)
* upstream/master:
  update reflect metadata dependency (#604)
* upstream/master:
  WIP - Activate environment in terminal (#614)
  Add telemetry for debugger (#546)
* upstream/master:
  Implements linting configuration (#599)
* upstream/master:
  Add command to create a python terminal (#625)
  Always display interpreter status bar (#623)
  Do not clear interpreter cache (#621)
* upstream/master:
  Create a release candidate (#663)
  Activation of terminal using conda activate and fixes to powershell script execution (#665)
* upstream/master:
  Validate file execution handler (#698)
  Update contributing guide (#687)
  Formatting on Enter (#649)
  Start the 2018.2.0 alpha (#685)
  Prep for 2018.1 final (#683)
  Speed up interpreter locators (#676)
* upstream/master:
  Debug specific unittest test ends up running all failed tests (#671)
  Fix unhandled promise rejections (#702)
  🐛 Fixes #700 replace back slashes in fie paths with forward slashes (#707)
  Validate file execution handler (#698)
  Update contributing guide (#687)
  Formatting on Enter (#649)
  Start the 2018.2.0 alpha (#685)
  Prep for 2018.1 final (#683)
  Speed up interpreter locators (#676)
  Create a release candidate (#663)
  Activation of terminal using conda activate and fixes to powershell script execution (#665)
  Register linter commands (#653)
  Preserve focus when sending text to a terminal (#651)
  Work around VSC issue with formatting on save #624 (#635)
  Korean translation (#540)
  Improving getting started instructions in README and minor updates to contributors guide (#605)
  Bump to a beta version for some testing (#630)
  Activate extension when command 'Create Terminal' is invoked (#632)
* upstream/master:
  Debugger unit tests (#724)
* upstream/master:
  Renamed default configuration name (#712)
  Improve tooltip display (#725)
* upstream/master:
  Renamed default configuration name (#712)
  Improve tooltip display (#725)
  Debugger unit tests (#724)
* upstream/master:
  Limit Jedi RAM consumption (#744)
  Fix debug test failure (#739)
  Ensure paths are always using forward slashes in terminal commands and args (#732)
* upstream/master:
  Add support for latest version of PTVSD as an experimental debugger (#745)
response.body = {
stackFrames: []
};
return this.sendResponse(response);
}

const pyThread = this.pythonProcess!.Threads.get(args.threadId)!;
const pyThread = Array.from(this.pythonProcess!.Threads.values()).find(t => t.Int32Id === args.threadId)!;
Copy link

@MikhailArkhipov MikhailArkhipov Feb 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth encapsulating search into IPythonProcess.threadFromIn32Id()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

@@ -38,13 +38,14 @@ export function validatePathSync(filePath: string): boolean {
return exists;
}

export function CreatePythonThread(id: number, isWorker: boolean, process: IPythonProcess, name: string = ''): IPythonThread {
export function CreatePythonThread(id: number, isWorker: boolean, process: IPythonProcess, name: string = '', int32Id: number = 0): IPythonThread {
Copy link

@MikhailArkhipov MikhailArkhipov Feb 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in HandleThreadCreate we are passing process to utils.CreatePythonThread. It might be better to make CreatePythonThread private within PythonProcess since all we really do in HandleThreadCreate is creating thread and then adding it to the process thread list. The PythonProcess could just do it internally. You probably wouldn't need _createdFirstThread either then.

Copy link

@MikhailArkhipov MikhailArkhipov Feb 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a related note, things like

        if (this.process.Threads.has(threadId)) {
            pyThread = this.process.Threads.get(threadId)!;
        }

could be encapsulated inside PythonProcess method since sequence appears to be repeated quite a bit. Moveover

        let threadId = this.stream.ReadInt64();
        if (this.stream.HasInsufficientDataForReading) {
            return;
        }
        let pyThread: IPythonThread | undefined;
        if (this.process.Threads.has(threadId)) {
            pyThread = this.process.Threads.get(threadId)!;
        }

appears to be used a lot too. Maybe make getThreadFromStream

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reluctant to make any changes, as all of the work would be obsolete with the new debugger work.

@codecov
Copy link

codecov bot commented Feb 12, 2018

Codecov Report

Merging #761 into master will decrease coverage by <.01%.
The diff coverage is 7.69%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #761      +/-   ##
==========================================
- Coverage   62.15%   62.15%   -0.01%     
==========================================
  Files         251      251              
  Lines       11588    11589       +1     
  Branches     2074     2074              
==========================================
  Hits         7203     7203              
- Misses       4377     4378       +1     
  Partials        8        8
Impacted Files Coverage Δ
src/client/debugger/Common/Contracts.ts 87.5% <ø> (ø) ⬆️
src/client/debugger/Main.ts 0% <0%> (ø) ⬆️
...rc/client/debugger/PythonProcessCallbackHandler.ts 0% <0%> (ø) ⬆️
src/client/debugger/Common/Utils.ts 22.95% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 937470e...3c86fa9. Read the comment docs.

@DonJayamanne DonJayamanne merged commit b4d8e42 into microsoft:master Feb 12, 2018
@DonJayamanne DonJayamanne deleted the useInt32ThreadIds branch February 22, 2018 19:22
@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Debugging Python code while using LiveShare fails
3 participants