Skip to content

Invalid sys.config results in code server crash #10214

@eproxus

Description

@eproxus

Describe the bug
When a sys.config is just a number followed by a letter (e.g. 7k), Erlang will crash with an obscure message not referencing the configuration or a line number at all:

$ erl -config sys
2025-09-18 11:54:22.548561 {error,simple_handler_process_dead}
2025-09-18 11:54:22.548391 Error in process ~p with exit value:~n~p~n
        <0.49.0>
        {undef,[{logger_formatter,format,[#{meta=>#{error_logger=>#{emulator=>true,tag=>error},pid=><0.45.0>,time=>1758189262547649,gl=><0.0.0>},msg=>{"Error in process ~p with exit value:~n~p~n",[<0.45.0>,{badarg,[{erlang,send,[code_server,{code_call,<0.45.0>,{finish_loading,[],true}}],[{error_info,#{module=>erl_erts_errors}}]},{code_server,call,1,[{file,"code_server.erl"},{line,163}]},{code,ensure_modules_loaded_1,1,[{file,"code.erl"},{line,1322}]},{io_lib,test_modules_loaded,3,[{file,"io_lib.erl"},{line,462}]},{io_lib,format,2,[{file,"io_lib.erl"},{line,338}]},{application_controller,init,2,[{file,"application_controller.erl"},{line,559}]}]}]},level=>error},#{time_offset=>[],depth=>unlimited,single_line=>false,legacy_header=>true}],[]},{logger_simple_h,'-log_internal/2-fun-0-',1,[{file,"logger_simple_h.erl"},{line,174}]}]}
Could not start kernel pid (application_controller) ("{badarg,[{erlang,send,[code_server,{code_call,<0.45.0>,{finish_loading,[],true}}],[{error_info,#{module => erl_erts_errors}}]},{code_server,call,1,[{file,\"code_server.erl\"},{line,163}]},{code,ensure_modules_loaded_1,1,[{file,\"code.erl\"},{line,1322}]},{io_lib,test_modules_loaded,3,[{file,\"io_lib.erl\"},{line,462}]},{io_lib,format,2,[{file,\"io_lib.erl\"},{line,338}]},{application_controller,init,2,[{file,\"application_controller.erl\"},{line,559}]}]}")

Crash dump is being written to: erl_crash.dump...done

To Reproduce

  1. Create a sys.config file with this content:
    7k
    
  2. Start Erlang erl -config sys in the same directory
  3. Erlang crashes

Expected behavior
Erlang reports a syntax error on the line where the error occurs.

Affected versions

28.0-28.1

(27 and below seems to work).

Additional context

We discovered this when templating long complicated sys.config files containing RSA private keys that were not correctly enclosed in Erlang syntax. It took us a really long time figuring out that this was a problem.

Erlang 27 and 28 seems to handle this syntax differently:

28:

Erlang/OTP 28 [erts-16.0.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Eshell V16.0.2 (press Ctrl+G to abort, type help(). for help)
1> 7k
k
* 1:1: illegal integer

27:

Erlang/OTP 27 [erts-15.2.7.2] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [jit]

Eshell V15.2.7.2 (press Ctrl+G to abort, type help(). for help)
1> 7k
   .
* 1:2: syntax error before: k

Metadata

Metadata

Assignees

Labels

bugIssue is reported as a bugteam:VMAssigned to OTP team VM

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions