microsoft / microsoft/vscode-cpptools

Debugger fails under Linux if file size limits are in effect

Offen
#13,768 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

bug debugger help wanted
Vorherrschende Sprache
TypeScript
Sterne
6.2k
Forks
1.7k
Ø Merge
14 Std. 46 Min.
Gemergte PRs (30 T.)
61

Beschreibung

Environment
  • OS and version: AlmaLinux 8.10
  • VS Code: 1.102.1 (and earlier)
  • C/C++ extension: ms-vscode.cpptools-1.23.5-linux-x64 and later
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version: gdb-8.2-20.el8.x86_64
Bug Summary and Steps to Reproduce

Bug Summary:
LIke many sites, we set a default file size ulimit to prevent users' runaway processes from consuming unlimited disk resources. When attempting to debug a C program with any file size limit less than 2TiB in place (cf. "grep 'Max file size' /proc/$$/limits"), the debugger crashes.

Steps to reproduce:

  1. Set a reasonable file size limit (e.g., "ulimit -f 25165824" from bash)
  2. Launch "code" from the shell prompt
  3. Open a .c file, build it, and set a breakpoint
  4. Select Run -> Start debugging

The debugger controls will appear briefly and disappear; the OpenDebugAD7 process will crash with SIGXFSZ.

Debugger Configurations
Default settings.
Debugger Logs
No messages in Debug Console or Output windows.
Other Extensions

No response

Additional Information

Attaching a system call tracer reveals that the process is attempting to truncate the file returned from a memfd_create("doublemapper") call to 2TB:

1354933 memfd_create("doublemapper", MFD_CLOEXEC) = 8
1354933 ftruncate(8, 2199023255552) = -1 EFBIG (File too large)

This may have the same root cause as https://github.com/microsoft/vscode/issues/251037 .

Setting "C_Cpp_Runner.debuggerPath": "lldb" in settings.json may work around the issue (OpenDebugAD7 does not appear to run in this configuration), but this is not the default configuration.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Reproduziere den Absturz mit dem angegebenen ulimit und verfolge den OpenDebugAD7-Prozess, wobei du dich auf den im Bericht gezeigten Aufruf memfd_create("doublemapper") und den Aufruf ftruncate konzentrierst. Vergleiche den standardmäßigen Debugger-Pfad mit dem dokumentierten LLDB-Workaround; abgeschlossen ist die Aufgabe, wenn eine C-Debugsitzung unter einer Dateigrößenbegrenzung gestartet werden kann, ohne SIGXFSZ oder einen verschwindenden Debugger.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
c, linux, vscode
Bereich
devtools, operating-systems
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.