pharo icon indicating copy to clipboard operation
pharo copied to clipboard

OnlineSourceDebugScope introduces bug when raising errors

Open jordanmontt opened this issue 1 month ago • 0 comments

We tested that when executing 1 error: 'foo' The method is called 4 times instead of 1. With some debugging we found out that the error comes from Context >> #tempsAndValuesLimitedTo:indent:.

That method calls self temporaryVariableNames which for some reason returns #(#aBlock #index) and the temp index does not exists. That launches another error. This process is repeated 3 times. That is the 4 error: calls (1 the original 1 error: 'foo' + the 3 other ones).

With some bisection we found out that the error is introduced in this PR: https://github.com/pharo-project/pharo/pull/18644/files


We also tested this disabling clean blocks and then we did OpalCompiler recompileAll which lead to another related error. OpalCompiler recompileAll breaks with ASTMessageNode does not understand sourceNodeForPC: . This error is also introduced in the same PR


How to reproduce

  • First install method proxies
  • run the first example
handler :=  MpCountingHandler new.
p := MpMethodProxy 
	onMethod: Object >> #error: 
	handler: handler.
p install.
p enableInstrumentation.
1 error: 'foo'.
p uninstall.
handler count.
  • You will see that the error method is executed 4 times instead of 1.

Possible related issues:

  • https://github.com/pharo-project/pharo/issues/17513
  • https://github.com/pharo-project/pharo/issues/18741
  • https://github.com/pharo-project/pharo/issues/18746

jordanmontt avatar Oct 24 '25 13:10 jordanmontt