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

Loop on include of shadowing module type substitution #1223

Open
lukemaurer opened this issue Oct 24, 2024 · 0 comments
Open

Loop on include of shadowing module type substitution #1223

lukemaurer opened this issue Oct 24, 2024 · 0 comments

Comments

@lukemaurer
Copy link
Contributor

This .mli makes odoc (either Jane Street's modified trunk or stock 2.4.3) loop:

(* can also be := *)
module type Fail = sig end

(* must be := *)
module type Monad := sig
  (* must be := and the same name *)
  module type Fail := Fail

  include Fail
end

include Monad

The precise behavior is slightly different between trunk and 2.4.3: on trunk, we get an immediate segfault that gdb shows happens tens of thousands of frames deep:

#0  camlOdoc_model__Paths__compare_10_10 () at paths.ml:181
#1  0x000000000103cfed in camlStdlib__Map__find_7_78_code () at map.ml:148
#2  0x00000000004d009b in camlOdoc_xref2__Tools__resolve_module_type_66_66 () at env.ml:154
#3  0x00000000004d9fd1 in camlOdoc_xref2__Tools__signature_of_u_module_type_expr_91_91 () at tools.ml:1646
#4  0x00000000004da669 in camlOdoc_xref2__Tools__expansion_of_module_type_expr_93_93 () at tools.ml:1687
#5  0x00000000004da06c in camlOdoc_xref2__Tools__signature_of_u_module_type_expr_91_91 () at tools.ml:1647
#6  0x00000000004da669 in camlOdoc_xref2__Tools__expansion_of_module_type_expr_93_93 () at tools.ml:1687
...

(with the last two frames repeating ad infinitum)

On 2.4.3, instead odoc hangs, and if I ask gdb for a backtrace I get something that at least looks different:

#0  0x000000000060468c in camlOdoc_xref2__Tools.process_module_type_2624 () at src/xref2/tools.ml:554
#1  0x000000000060a8e9 in camlOdoc_xref2__Tools.fun_7266 () at src/xref2/tools.ml:1170
#2  0x0000000000604460 in camlOdoc_xref2__Tools.get_module_type_path_modifiers_2623 () at src/xref2/tools.ml:526
#3  0x0000000000604604 in camlOdoc_xref2__Tools.process_module_type_2624 () at src/xref2/tools.ml:550
#4  0x000000000060a8e9 in camlOdoc_xref2__Tools.fun_7266 () at src/xref2/tools.ml:1170
#5  0x0000000000604460 in camlOdoc_xref2__Tools.get_module_type_path_modifiers_2623 () at src/xref2/tools.ml:526
#6  0x0000000000604604 in camlOdoc_xref2__Tools.process_module_type_2624 () at src/xref2/tools.ml:550
...

(again, it repeats for thousands of frames)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant