Can't run Nitrogen file a second time

I have a strange issue cropped up. After I generate a nitrogen project for windows and run start.cmd once any subsequent runs crash immediately. I know this for sure because there is a

erl_crash.dump

file in the project folder. I am posting a link to it cause I don’t know how to read crash dump files.

Thanks

2 Likes

The error at the top of the crash dump is this:

could not start kernel pid (application_controller) (invalid config data: duplicate application config: sync)

The windows Nitrogen package generates the file etc/app.generated.config every time you start your app (pulling from the other .config files in etc. It should only have one section labeled sync in it (if any at all).

I’m curious what’s in this file?

2 Likes
[{sync,[{growl,all},
        {log,all},
        {non_descendant,fix},
        {excluded_modules,[]},
        {executable,auto}]},
 {simple_bridge,[{handler,nitrogen},
                 {backend,inets},
                 {address,"0.0.0.0"},
                 {port,8000},
                 {document_root,"./site/static"},
                 {static_paths,["js/","css/","images/","nitrogen/",
                                "favicon.ico"]},
                 {max_post_size,10},
                 {max_file_size,10},
                 {max_file_in_memory_size,0},
                 {scratch_dir,"./scratch"}]},
 {sync,[{growl,all},
        {log,all},
        {non_descendant,fix},
        {excluded_modules,[]},
        {executable,auto}]},
 {simple_bridge,[{handler,nitrogen},
                 {backend,inets},
                 {address,"0.0.0.0"},
                 {port,8000},
                 {document_root,"./site/static"},
                 {static_paths,["js/","css/","images/","nitrogen/",
                                "favicon.ico"]},
                 {max_post_size,10},
                 {max_file_size,10},
                 {max_file_in_memory_size,0},
                 {scratch_dir,"./scratch"}]},
 {sync,[{growl,all},
        {log,all},
        {non_descendant,fix},
        {excluded_modules,[]},
        {executable,auto}]},
 {simple_bridge,[{handler,nitrogen},
                 {backend,inets},
                 {address,"0.0.0.0"},
                 {port,8000},
                 {document_root,"./site/static"},
                 {static_paths,["js/","css/","images/","nitrogen/",
                                "favicon.ico"]},
                 {max_post_size,10},
                 {max_file_size,10},
                 {max_file_in_memory_size,0},
                 {scratch_dir,"./scratch"}]},
 {sync,[{growl,all},
        {log,all},
        {non_descendant,fix},
        {excluded_modules,[]},
        {executable,auto}]},
 {simple_bridge,[{handler,nitrogen},
                 {backend,inets},
                 {address,"0.0.0.0"},
                 {port,8000},
                 {document_root,"./site/static"},
                 {static_paths,["js/","css/","images/","nitrogen/",
                                "favicon.ico"]},
                 {max_post_size,10},
                 {max_file_size,10},
                 {max_file_in_memory_size,0},
                 {scratch_dir,"./scratch"}]},
 {sync,[{growl,all},
        {log,all},
        {non_descendant,fix},
        {excluded_modules,[]},
        {executable,auto}]},
 {simple_bridge,[{handler,nitrogen},
                 {backend,inets},
                 {address,"0.0.0.0"},
                 {port,8000},
                 {document_root,"./site/static"},
                 {static_paths,["js/","css/","images/","nitrogen/",
                                "favicon.ico"]},
                 {max_post_size,10},
                 {max_file_size,10},
                 {max_file_in_memory_size,0},
                 {scratch_dir,"./scratch"}]},
 {sync,[{growl,all},
        {log,all},
        {non_descendant,fix},
        {excluded_modules,[]},
        {executable,auto}]},
 {simple_bridge,[{handler,nitrogen},
                 {backend,inets},
                 {address,"0.0.0.0"},
                 {port,8000},
                 {document_root,"./site/static"},
                 {static_paths,["js/","css/","images/","nitrogen/",
                                "favicon.ico"]},
                 {max_post_size,10},
                 {max_file_size,10},
                 {max_file_in_memory_size,0},
                 {scratch_dir,"./scratch"}]},
 {nitrogen_core,[]},
 {sasl,[{sasl_error_logger,{file,"log/sasl-error.log"}},
        {errlog_type,error},
        {error_logger_mf_dir,"log/sasl"},
        {error_logger_mf_maxbytes,10485760},
        {error_logger_mf_maxfiles,5}]},
 {nitrogen_core,[]},
 {sasl,[{sasl_error_logger,{file,"log/sasl-error.log"}},
        {errlog_type,error},
        {error_logger_mf_dir,"log/sasl"},
        {error_logger_mf_maxbytes,10485760},
        {error_logger_mf_maxfiles,5}]},
 {nitrogen_core,[]},
 {sasl,[{sasl_error_logger,{file,"log/sasl-error.log"}},
        {errlog_type,error},
        {error_logger_mf_dir,"log/sasl"},
        {error_logger_mf_maxbytes,10485760},
        {error_logger_mf_maxfiles,5}]},
 {nitrogen_core,[]},
 {sasl,[{sasl_error_logger,{file,"log/sasl-error.log"}},
        {errlog_type,error},
        {error_logger_mf_dir,"log/sasl"},
        {error_logger_mf_maxbytes,10485760},
        {error_logger_mf_maxfiles,5}]},
 {nitrogen_core,[]},
 {sasl,[{sasl_error_logger,{file,"log/sasl-error.log"}},
        {errlog_type,error},
        {error_logger_mf_dir,"log/sasl"},
        {error_logger_mf_maxbytes,10485760},
        {error_logger_mf_maxfiles,5}]},
 {nitrogen_core,[]},
 {sasl,[{sasl_error_logger,{file,"log/sasl-error.log"}},
        {errlog_type,error},
        {error_logger_mf_dir,"log/sasl"},
        {error_logger_mf_maxbytes,10485760},
        {error_logger_mf_maxfiles,5}]}].

Looks like there are several syncs and it vomited over itself several times over… :face_vomiting:

[{sync,[{growl,all},
        {log,all},
        {non_descendant,fix},
        {excluded_modules,[]},
        {executable,auto}]},
 {simple_bridge,[{handler,nitrogen},
                 {backend,inets},
                 {address,"0.0.0.0"},
                 {port,8000},
                 {document_root,"./site/static"},
                 {static_paths,["js/","css/","images/","nitrogen/",
                                "favicon.ico"]},
                 {max_post_size,10},
                 {max_file_size,10},
                 {max_file_in_memory_size,0},
                 {scratch_dir,"./scratch"}]},
 {sync,[{growl,all},
        {log,all},
        {non_descendant,fix},
        {excluded_modules,[]},
        {executable,auto}]},
 {simple_bridge,[{handler,nitrogen},
                 {backend,inets},
                 {address,"0.0.0.0"},
                 {port,8000},
                 {document_root,"./site/static"},
                 {static_paths,["js/","css/","images/","nitrogen/",
                                "favicon.ico"]},
                 {max_post_size,10},
                 {max_file_size,10},
                 {max_file_in_memory_size,0},
                 {scratch_dir,"./scratch"}]},
 {sync,[{growl,all},
        {log,all},
        {non_descendant,fix},
        {excluded_modules,[]},
        {executable,auto}]},
 {simple_bridge,[{handler,nitrogen},
                 {backend,inets},
                 {address,"0.0.0.0"},
                 {port,8000},
                 {document_root,"./site/static"},
                 {static_paths,["js/","css/","images/","nitrogen/",
                                "favicon.ico"]},
                 {max_post_size,10},
                 {max_file_size,10},
                 {max_file_in_memory_size,0},
                 {scratch_dir,"./scratch"}]},

Those are the 1st few lines…

2 Likes

Interesting. It looks like it’s copying that config file multiple times.

Try deleting the app.generated.config file and re-running it. I’ll bet that works, but something must be happening on your system that it’s not doing on mine. Not entirely sure yet.

Can I assume this is on Windows 10? Or Windows 11? Or something older?

2 Likes

Deleting the file works but, it would have to be done every time I want to run the server. I am on Windows 10, Version 21H1, OS Build 19043.1645, Experience Windows Experience Feature Pack 120.2212.4170.0.

2 Likes

I agree, that is not a permanent solution.

For kicks, I just tried and it’s not reproducing this behavior for me on Windows 10.

However, I have a hunch and made some changes.

Try replacing the merge-configs.escript file with this one and let me know if this solves it for you: possible replacement merge-configs.escript · GitHub

2 Likes

@gumm
I also have been tinkering a bit in shell script and have come up with a workaround, Add the following line to start.cmd:

if exist "etc\app.generated.config" (
	echo " old config file exists, deleting"
	del "etc\app.generated.config"
)

It should look like this:

@echo off
set PA=
set PA=%PA% ./site/ebin
set PA=%PA% ./site/include
if exist "etc\app.generated.config" (
	echo "file exists"
	del "etc\app.generated.config"
)
cmd /c build-ini.bat
erts-11.0\bin\escript.exe merge-configs.escript ./etc
erts-11.0\bin\erl -boot releases/2.4.0/nitrogen -pa %PA% -make
erts-11.0\bin\werl -pa %PA% -boot releases/2.4.0/nitrogen -embedded -config etc/app.generated.config  -args_file etc/vm.args

All this does is check if the file exists beforehand and force Erlang to create a fresh one every time the app is started by deleting it. I will try your fix in a few hours. I am a bit busy at the moment.

2 Likes

Very good. That should work, too!

2 Likes

That new merge-configs.escript you provided seems to have fixed the issue. Is that going to be in the next version of nitrogen or even mentioned in the README as a potential workaround meanwhile?

2 Likes

Glad to see that’s working for you.

This new script will be merged into mainline Nitrogen 2, but Nitrogen 3 Windows handling has been overhauled, making that script unnecessary.

3 Likes