VSCode - Source code files getting corrupted arbitrarily

While working on VScode, occassionally the code I’m working on gets corrupted - usually a few lines will get deleted or a bunch of spaces added. This usually happens on the file I’m editing, but not at the place I’m editing.

VSCode running on Jetson Xavier NX with only the Python extension installed. publisher:“Microsoft”

Has anyone experienced this issue? It’s happening as much as every 10min. Makes it almost unusable for development. Any suggestions on how to fix this will be gravely welcomed.

–Mike

There’s no way for me to answer, but some questions probably needed for answering are:

  • Is it possible your power source is marginal, and has some “brown out” when under heavier load (such as when writing to disk)?
  • How are you connected to the NX? Ssh and forward? Direct terminal?
  • What kind of storage are you using (is this the dev kit, if so, what SD)? Is this eMMC model? Do you have external storage?
  • If you monitor “dmesg --follow” in another terminal while editing, do you see any messages about the same time as the issue occurs?
1 Like

I am using the Jetson Xavier NX Developer Kit. It it using the power supply that came in the box. There are no additional processes running other than what is part of the SDCard image that I downloaded from Nvidia. I don’t thin kit is a supply issue.

My connection is a 1080p monitor connected to the NX via HDMI. Keyboard/Mouse is connected to the USB ports if the NX. Pretty much using it like a standard desktop.

I have a Samsung - 970 EVO 500GB Internal PCI Express 3.0 x4 (NVMe) Solid State Drive with V-NAND Technology Model:MZ-V7E500BW attached.

I have the same corruption issue when editing files on both the SDCard and the SSD. So I don’t think it is related to the drives. I don’t have any stability issues at all with the NX. Everything works just fine. Just the corruption issue when editing in VSCode. I’m beginning to think it is related to the Python extension in VSCode. or VSCode itself. I can’t find anyone having this issue online.

The following are the exact steps to get to the environment I am running. I repeated these steps by re-flashing and following them verbatim.

#STEP0 - Flashed Jetson Xavier NX Developer Kit SD Card Image (JetPack 4.4) to a Samsung (MB-ME128GA/AM) CLASS10 - 128GB 100MB/s (U3) MicroSDXC EVO

#STEP1 - Booted and answered questions… (Did not do any updates)

#STEP2 - install pip3
$ sudo apt-get install python3-pip

#STEP3 - Install jetson-stats and reboot
$ sudo -H pip3 install -U jetson-stats

#STEP4 - Install Visual Studio Code
$ sudo apt-get install curl
$ cd Downloads
$ curl -L https://github.com/toolboc/vscode/releases/download/1.32.3/code-oss_1.32.3-arm64.deb -o code-oss_1.32.3-arm64.deb
$ sudo dpkg -i code-oss_1.32.3-arm64.deb

#STEP5 - Launch Visual Studio Code
$ code-oss

#STEP6 - Select Interpreter / Fix OpenCV Intellesense
1. In VSCode add extention - [Python extension for Visual Studio Code from Microsoft]

2. Press ctl+shift+p (type >python select 
	Select Python:Select Interpreter
	Select Python 3.6.9 64-bit

4. [Fix broken cv2 intellesense]
	Press ctl+shift+p (type: >preferences:open)
	Select Preferences: Open Settings (JSON)
	Edit the JSON file, Add these settings inside the {   } :
		"python.linting.pylintArgs": ["--generate-members", "--extension-pkg-whitelist=cv2"],
		"python.autoComplete.extraPaths": ["/usr/lib/python3.6/dist-packages/cv2/python-3.6"]

#STEP7 - Visit The Jetson Zoo
Download the repo
$ git clone --recursive GitHub - dusty-nv/jetson-inference: Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.
$ cd jetson-inference

Configure build tree
	$ mkdir build
	$ cd build
	$ cmake ../

Build and install
	$ make -j$(nproc)
	$ sudo make install
	$ sudo ldconfig

#STEP8 - Installed Filezilla (ftp program)
$ sudo apt-get update
$ sudo apt-get install filezilla
$ filezilla (to run)

How is the drive partitioned, is it formatted as ext4, and where is it mounted?

If you monitor “dmesg --follow”, and you see the issue occur, is there any error message visible which might be related to this?

The NVMe is the only difference, and I’ve not heard of the supplied power supply being insufficient even in this case, so I too wonder if it is software. However, the dmesg log is likely to say something if it is not a user space issue.

$ lsblk -b nvme0n1 -o “NAME,MAJ:MIN,RM,SIZE,RO,FSTYPE,MOUNTPOINT”

NAME MAJ:MIN RM SIZE RO FSTYPE MOUNTPOINT
nvme0n1 259:0 0 500107862016 0 ext4

I’ll monitor and keep watching. Haven’t seen any errors so far.

Here are the steps I used to format the SDCard and create the bootable image.

#Step1 - Downloaded App To Format SD card. (MAC version)
https://www.sdcard.org/

#Step2 - Downloaded App to Write Image to SD card (MAC version)
balenaEtcher - Flash OS images to SD cards & USB drives

#Step3 - Downloaded JetPack 4.4 SDCard Image
JetPack SDK | NVIDIA Developer

#Step4 - Used SD Card Formatter to format SDCard. (From Step1)

#Step5 - Used BalenaEtcher to write the image to the formatted SDCard. (From Step2)

In VSCode I went to the settings and changed the formatting provider for Python from (autopep8) to (none).
This seems to have fixed the issue, I haven’t had any arbitrarily code changes occur yet… crossing fingers…

This plugin seems to have some kind of issue when running on the Jetson Xavier NX. I wonder if anyone out there noticed this issue.

VSCode Plugin/Extension - Python (ms-python.python) publisher:“Microsoft” v2020.9.114305
Linting, Debugging (multi-threaded, remote), Intellisense, Jupyter Notebooks, code formatting, refactoring, unit tests, snippets, and more.

Extensions:
Python:
Formatting: Provider
Provider for formatting. Possible options include ‘autopep8’, ‘black’, and ‘yapf’.

	Options
	-------
	autopep8	-- (Default)
	black
	yapf
	none		-- SELECT THIS ONE

Note: I’ll mark this issue as complete when I feel comfortable it fixed the issue.

I have had another hiccup in the editor. This may be related to the previous issue. While scrolling up with the mouse. I have had the code get changed when the top was reached and I continued to try to scroll up. This seemed to happen only once. May have been a glitch in VSCode. from switching back an fourth between tabs and mouse scrolling.

I do believe turning off the Python Formatting Provider has fixed most of the issues I was having.