Skip to content

[Bug]: GPR parser constraint error loading project #1245

Open
@tocklime

Description

@tocklime

Environment

  • OS and Version: Windows 11
  • IDE Version: VSCode 1.98.2
  • Ada & SPARK Extension Version: 26.0.202412191

Bug Summary and Reproducer

Bug Summary:

When loading GPR files I get the following stack trace in the VSCode 'problems' window, and in the ~/.als/ log files:

GPR parser unexpected raised CONSTRAINT_ERROR : GPR2.View_Internal.Project_View_Store.Insert: key already in map
Load address: 0x7ff638f80000
[c:\Users\username\.vscode\extensions\adacore.ada-26.0.202412191-win32-x64\x64\win32\ada_language_server.exe]
0x7ff63c10cb9f gpr2__view_internal__project_view_store__insert__2.part.0 at ???
0x7ff63c12673e gpr2__view_internal__project_view_store__insert__2 at ???
0x7ff63c08d892 gpr2__tree_internal__set_context__2 at ???
0x7ff63c08e64c gpr2__tree_internal__set_context at ???
0x7ff63c092090 gpr2__tree_internal__load at ???
0x7ff63c096660 gpr2__tree_internal__load_autoconf at ???
0x7ff63beffd9a gpr2__project__tree__load at ???
0x7ff63a103c87 Lsp.Gpr_Documents.Load at lsp-gpr_documents.adb:219
0x7ff63a12e755 Lsp.Gpr_Handlers.On_Didopen_Notification at lsp-gpr_handlers.adb:225
0x7ff63a11e1fa Lsp.Gpr_Handlers.On_Server_Notification at lsp-gpr_handlers.adb:578
0x7ff6393559c6 Lsp.Default_Message_Handlers.Execute at lsp-default_message_handlers.adb:85
0x7ff6393619bf Lsp.Job_Schedulers.Process_High_Priority_Job at lsp-job_schedulers.adb:155
0x7ff63a1acdc0 Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:892
0x7ff63c5905c2 system__tasking__stages__task_wrapper at ???
[C:\WINDOWS\System32\KERNEL32.DLL]
0x7ffe16c5e8d5
[C:\WINDOWS\SYSTEM32\ntdll.dll]
0x7ffe1861bf6a

I have the following gpr dependency graph:

configlib -> Common
configlib -> Runtime -> Common
configlib -> Oslib -> Common

Loading any of Common, Runtime, Oslib works OK. If I use configlib.gpr as the project in vs code, I get the stack trace.
It goes away if I roll back to an earlier version:

Oldest broken version I can find is 25.0.20241014.
Newest working version I can find is 25.0.20240915.

Steps to reproduce:
I've tried making a project from scratch with a similar structure but not managed it.

Expected behavior:
No stack trace, functional language server.

Configuration and Logs

[ALS.MAIN] ALS version: 25.0 (20241014)
[ALS.MAIN] Initializing server ...
[ALS.MAIN] GPR PATH: libs\3rdparty_gpr
[ALS.MAIN] PATH: [removed]
[ALS.MAIN] In Text_Document_Did_Open
[ALS.MAIN] Uri : file:///c%3A/Users/[removed]/src/configlib/configlib.gpr
[ALS.MAIN] Exception:
[ALS.MAIN] raised CONSTRAINT_ERROR : GPR2.View_Internal.Project_View_Store.Insert: key already in map
_ALS.MAIN_ Load address: 0x7ff69b950000
_ALS.MAIN_ [c:\Users\[removed]\.vscode\extensions\adacore.ada-25.0.20241014-win32-x64\x64\win32\ada_language_server.exe]
_ALS.MAIN_ 0x7ff69eac8a78 gpr2__view_internal__project_view_store__insert__2.part.0 at ???
_ALS.MAIN_ 0x7ff69eae34fe gpr2__view_internal__project_view_store__insert__2 at ???
_ALS.MAIN_ 0x7ff69ea45920 gpr2__tree_internal__set_context__2 at ???
_ALS.MAIN_ 0x7ff69ea469f3 gpr2__tree_internal__set_context at ???
_ALS.MAIN_ 0x7ff69ea4a9de gpr2__tree_internal__load at ???
_ALS.MAIN_ 0x7ff69ea4ec66 gpr2__tree_internal__load_autoconf at ???
_ALS.MAIN_ 0x7ff69e8af1a6 gpr2__project__tree__load at ???
_ALS.MAIN_ 0x7ff69cad43b6 Lsp.Gpr_Documents.Load at lsp-gpr_documents.adb:195
_ALS.MAIN_ 0x7ff69caff580 Lsp.Gpr_Handlers.On_Didopen_Notification at lsp-gpr_handlers.adb:225
_ALS.MAIN_ 0x7ff69caee6fa Lsp.Gpr_Handlers.On_Server_Notification at lsp-gpr_handlers.adb:578
_ALS.MAIN_ 0x7ff69bd43966 Lsp.Default_Message_Handlers.Execute at lsp-default_message_handlers.adb:85
_ALS.MAIN_ 0x7ff69bd4fa7f Lsp.Job_Schedulers.Process_High_Priority_Job at lsp-job_schedulers.adb:148
_ALS.MAIN_ 0x7ff69cbfd620 Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:882
_ALS.MAIN_ 0x7ff69ef52462 system__tasking__stages__task_wrapper at ???
_ALS.MAIN_ [C:\WINDOWS\System32\KERNEL32.DLL]
_ALS.MAIN_ 0x7ffe16c5e8d5
_ALS.MAIN_ [C:\WINDOWS\SYSTEM32\ntdll.dll]
_ALS.MAIN_ 0x7ffe1861bf6a
[ALS.MAIN] Load address: 0x7ff69b950000
_ALS.MAIN_ [c:\Users\[removed]\.vscode\extensions\adacore.ada-25.0.20241014-win32-x64\x64\win32\ada_language_server.exe]
_ALS.MAIN_ 0x7ff69eac8a78 gpr2__view_internal__project_view_store__insert__2.part.0 at ???
_ALS.MAIN_ 0x7ff69eae34fe gpr2__view_internal__project_view_store__insert__2 at ???
_ALS.MAIN_ 0x7ff69ea45920 gpr2__tree_internal__set_context__2 at ???
_ALS.MAIN_ 0x7ff69ea469f3 gpr2__tree_internal__set_context at ???
_ALS.MAIN_ 0x7ff69ea4a9de gpr2__tree_internal__load at ???
_ALS.MAIN_ 0x7ff69ea4ec66 gpr2__tree_internal__load_autoconf at ???
_ALS.MAIN_ 0x7ff69e8af1a6 gpr2__project__tree__load at ???
_ALS.MAIN_ 0x7ff69cad43b6 Lsp.Gpr_Documents.Load at lsp-gpr_documents.adb:195
_ALS.MAIN_ 0x7ff69caff580 Lsp.Gpr_Handlers.On_Didopen_Notification at lsp-gpr_handlers.adb:225
_ALS.MAIN_ 0x7ff69caee6fa Lsp.Gpr_Handlers.On_Server_Notification at lsp-gpr_handlers.adb:578
_ALS.MAIN_ 0x7ff69bd43966 Lsp.Default_Message_Handlers.Execute at lsp-default_message_handlers.adb:85
_ALS.MAIN_ 0x7ff69bd4fa7f Lsp.Job_Schedulers.Process_High_Priority_Job at lsp-job_schedulers.adb:148
_ALS.MAIN_ 0x7ff69cbfd620 Lsp.Servers.Processing_Task_TypeT at lsp-servers.adb:882
_ALS.MAIN_ 0x7ff69ef52462 system__tasking__stages__task_wrapper at ???
_ALS.MAIN_ [C:\WINDOWS\System32\KERNEL32.DLL]
_ALS.MAIN_ 0x7ffe16c5e8d5
_ALS.MAIN_ [C:\WINDOWS\SYSTEM32\ntdll.dll]
_ALS.MAIN_ 0x7ffe1861bf6a
[ALS.MAIN] Finished Text_Document_Did_Open
[ALS.MAIN] In Text_Document_Did_Open
[ALS.MAIN] Uri : file:///c%3A/Users/[removed]/src/runtime/runtime.gpr
[ALS.MAIN] Finished Text_Document_Did_Open
[ALS.MAIN] In Text_Document_Did_Open
[ALS.MAIN] Uri : file:///c%3A/Users/[removed]/src/oslib/oslib.gpr
[ALS.MAIN] Finished Text_Document_Did_Open

Other VS Code Extensions

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions