Closed mdg closed 9 years ago
Questions:
non_descendants
features at all?Is this happening with just this intro_handler file, or is it with every file?
The thing that stands out to me here is the combination of module could not be loaded
and possibly the outdir
.
This sounds like the compile
module isn't loaded, or might not even be present.
What happens if you try to execute (from the erlang shell):
> compile:file("/home/mdg/src/rechecks/src/intro_handler.erl").
And if that works, try this:
> Opts = [binary,return,debug_info,warn_export_all,warn_export_vars,
warn_obsolete_guard,warn_shadow_vars,warnings_as_errors,
{dtl,false},
{i,"/home/mdg/src/rechecks/include"},
{outdir,
"/home/mdg/src/rechecks/_rel/rechecks_release/lib/rechecks-0.1.0/ebin"}].
> compile:file("/home/mdg/src/rechecks/src/intro_handler.erl", Opts).
I'm curious what happens here.
Here's a link to the project in dropbox. https://www.dropbox.com/s/lhnkry0deehjtcw/rechecks.tgz?dl=0
I created it with the cowboy initialization scripts, added a couple handlers and then tried to add sync. I start the app w/ _rel/rechecks_release/bin/rechecks_release console
as indicated by the cowboy documentation I was following.
I've not tried the non_descendants feature, but this example is so simple, it doesn't seem like I should need it right?
This does seem to happen to every file I change. However, intro_handler.erl seems to fail even if I don't have it open and just let the app sit a few minutes.
The compile module does appear to be missing when I launch the app this way. However, if I just launch erl
then the compile module is available. I'm not familiar enough w/ erlang to guess why that might be.
Thanks for that. I believe I've found the culprit!
Try the newest version of sync I just pushed.
-Jesse
On Mon, Sep 29, 2014 at 8:55 PM, Matthew Graham notifications@github.com wrote:
Here's a link to the project in dropbox. https://www.dropbox.com/s/lhnkry0deehjtcw/rechecks.tgz?dl=0
I created it with the cowboy initialization scripts, added a couple handlers and then tried to add sync. I start the app w/ _rel/rechecks_release/bin/rechecks_release console as indicated by the cowboy documentation I was following.
I've not tried the non_descendants feature, but this example is so simple, it doesn't seem like I should need it right?
This does seem to happen to every file I change. However, intro_handler.erl seems to fail even if I don't have it open and just let the app sit a few minutes.
The compile module does appear to be missing when I launch the app this way. However, if I just launch erl then the compile module is available. I'm not familiar enough w/ erlang to guess why that might be.
— Reply to this email directly or view it on GitHub https://github.com/rustyio/sync/issues/45#issuecomment-57257072.
Jesse Gumm Owner, Sigma Star Systems 414.940.4866 || sigma-star.com || @jessegumm
Oh, and the problem, I believe, has to do with how relx creates its releases. In the case of sync, it needs the compiler application included in sync.app. So I added compiler and syntax_tools to it. I'm reasonably sure this will make it work.
Boom, that worked! Thanks!
I did get this error on the first edit but then it recompiles immediately and works fine after that.
=ERROR REPORT==== 1-Oct-2014::00:39:22 ===
/home/mdg/src/rechecks/src/intro_handler.erl:none: Error: no such file or directory
=INFO REPORT==== 1-Oct-2014::00:39:23 ===
/home/mdg/src/rechecks/src/intro_handler.erl:0: Recompiled.
=INFO REPORT==== 1-Oct-2014::00:39:23 ===
intro_handler: Reloaded! (Beam changed.)
I also still get this error compiling a cowboy file once per run. That's not a file I'm changing and doesn't appear to interfere with development.
** Reason for termination ==
** {'module could not be loaded',
[{epp_dodger,parse_file,
["/home/mdg/src/rechecks/deps/cowboy/src/cowboy.erl"],
[]},
{sync_scanner,'-who_include/2-fun-0-',2,
[{file,"src/sync_scanner.erl"},{line,621}]},
{lists,'-filter/2-lc$^0/1-0-',2,[{file,"lists.erl"},{line,1284}]},
{sync_scanner,process_hrl_file_lastmod,4,
[{file,"src/sync_scanner.erl"},{line,608}]},
{sync_scanner,handle_cast,2,
[{file,"src/sync_scanner.erl"},{line,254}]},
{gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,599}]},
{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}
Excellent!
The epp_dodger issue is caused by syntax_tools not being copied by relx. TO ensure syntax_tools gets copied, you're going to want to include it in your relx config in the 'release' section.
Jesse Gumm Owner, Sigma Star Systems 414.940.4866 || sigma-star.com || @jessegumm On Sep 30, 2014 11:51 PM, "Matthew Graham" notifications@github.com wrote:
Boom, that worked! Thanks!
I did get this error on the first edit but then it recompiles immediately and works fine after that.
=ERROR REPORT==== 1-Oct-2014::00:39:22 === /home/mdg/src/rechecks/src/intro_handler.erl:none: Error: no such file or directory
=INFO REPORT==== 1-Oct-2014::00:39:23 === /home/mdg/src/rechecks/src/intro_handler.erl:0: Recompiled.
=INFO REPORT==== 1-Oct-2014::00:39:23 === intro_handler: Reloaded! (Beam changed.)
I also still get this error compiling a cowboy file once per run. That's not a file I'm changing and doesn't appear to interfere with development.
* Reason for termination == * {'module could not be loaded', [{epp_dodger,parse_file, ["/home/mdg/src/rechecks/deps/cowboy/src/cowboy.erl"], []}, {sync_scanner,'-who_include/2-fun-0-',2, [{file,"src/sync_scanner.erl"},{line,621}]}, {lists,'-filter/2-lc$^0/1-0-',2,[{file,"lists.erl"},{line,1284}]}, {sync_scanner,process_hrl_file_lastmod,4, [{file,"src/sync_scanner.erl"},{line,608}]}, {sync_scanner,handle_cast,2, [{file,"src/sync_scanner.erl"},{line,254}]}, {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,599}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}
— Reply to this email directly or view it on GitHub https://github.com/rustyio/sync/issues/45#issuecomment-57418766.
Okay, proper fix deployed. In the end, you need to update your relx file (it was my fault misunderstanding some of relx): https://github.com/rustyio/sync#sync-with-relx
Super, that epp_dodger error is now gone!
I'm still getting output that files are changing that I haven't changed. Here's what happens:
Output:
mdg@redbanana:~/src/rechecks$ _rel/rechecks_release/bin/rechecks_release consoleExec: /home/mdg/src/rechecks/_rel/rechecks_release/erts-6.1.2/bin/erlexec -boot /home/mdg/src/rechecks/_rel/rechecks_release/releases/1/rechecks_release -env ERL_LIBS /home/mdg/src/rechecks/_rel/rechecks_release/releases/1/lib -config /home/mdg/src/rechecks/_rel/rechecks_release/releases/1/sys.config -args_file /home/mdg/src/rechecks/_rel/rechecks_release/releases/1/vm.args -- console
Root: /home/mdg/src/rechecks/_rel/rechecks_release
/home/mdg/src/rechecks/_rel/rechecks_release
heart_beat_kill_pid = 22088
Erlang/OTP 17 [DEVELOPMENT] [erts-6.1.2] [source-8ad5bd0] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Starting Sync (Automatic Code Compiler / Reloader)
Scanning source files...
application:start(sync)
Eshell V6.1.2 (abort with ^G)
(rechecks@127.0.0.1)1>
=INFO REPORT==== 5-Oct-2014::14:43:54 ===
/home/mdg/src/rechecks/deps/cowboy/src/cowboy_protocol.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:43:54 ===
/home/mdg/src/rechecks/deps/cowlib/src/cow_http.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:43:54 ===
/home/mdg/src/rechecks/deps/cowlib/src/cow_http_hd.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:43:55 ===
/home/mdg/src/rechecks/deps/cowlib/src/cow_multipart.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:43:55 ===
/home/mdg/src/rechecks/src/intro_handler.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:43:55 ===
cow_http_hd: Reloaded! (Beam changed.)
=INFO REPORT==== 5-Oct-2014::14:43:55 ===
cowboy_protocol: Reloaded! (Beam changed.)
=INFO REPORT==== 5-Oct-2014::14:43:55 ===
intro_handler: Reloaded! (Beam changed.)
=INFO REPORT==== 5-Oct-2014::14:45:18 ===
/home/mdg/src/rechecks/src/intro_handler.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:45:18 ===
intro_handler: Reloaded! (Beam changed.)
So that's what happens if I start the app and immediately change a file. If I start the app, then wait before changing a file, I get the following:
Output:
mdg@redbanana:~/src/rechecks$ _rel/rechecks_release/bin/rechecks_release consoleExec: /home/mdg/src/rechecks/_rel/rechecks_release/erts-6.1.2/bin/erlexec -boot /home/mdg/src/rechecks/_rel/rechecks_release/releases/1/rechecks_release -env ERL_LIBS /home/mdg/src/rechecks/_rel/rechecks_release/releases/1/lib -config /home/mdg/src/rechecks/_rel/rechecks_release/releases/1/sys.config -args_file /home/mdg/src/rechecks/_rel/rechecks_release/releases/1/vm.args -- console
Root: /home/mdg/src/rechecks/_rel/rechecks_release
/home/mdg/src/rechecks/_rel/rechecks_release
heart_beat_kill_pid = 22409
Erlang/OTP 17 [DEVELOPMENT] [erts-6.1.2] [source-8ad5bd0] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
Starting Sync (Automatic Code Compiler / Reloader)
Scanning source files...
application:start(sync)
Eshell V6.1.2 (abort with ^G)
(rechecks@127.0.0.1)1>
=INFO REPORT==== 5-Oct-2014::14:54:33 ===
/home/mdg/src/rechecks/src/intro_handler.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:55:07 ===
/home/mdg/src/rechecks/deps/cowboy/src/cowboy_protocol.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:55:07 ===
/home/mdg/src/rechecks/deps/cowlib/src/cow_http.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:55:07 ===
/home/mdg/src/rechecks/deps/cowlib/src/cow_http_hd.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:55:08 ===
/home/mdg/src/rechecks/deps/cowlib/src/cow_multipart.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:55:08 ===
cow_http_hd: Reloaded! (Beam changed.)
=INFO REPORT==== 5-Oct-2014::14:55:08 ===
cowboy_protocol: Reloaded! (Beam changed.)
=INFO REPORT==== 5-Oct-2014::14:57:36 ===
/home/mdg/src/rechecks/src/intro_handler.erl:0: Recompiled.
=INFO REPORT==== 5-Oct-2014::14:57:36 ===
intro_handler: Reloaded! (Beam changed.)
Just to clarify again, I'm providing this feedback in case it helps you improve sync, but it's working well enough for me to use it now. Also, since it's those specific cowboy files, maybe it's cowboy related?
I definitely appreciate it.
It's not a cowboy issue - I suspect there's something about the the relx release structure that's making sync think it needs to recompile the files when they're first loaded - I'd have to look into it more, experimenting with relx and sync.
-Jesse
On Sun, Oct 5, 2014 at 2:01 PM, Matthew Graham notifications@github.com wrote:
Just to clarify again, I'm providing this feedback in case it helps you improve sync, but it's working well enough for me to use it now. Also, since it's those specific cowboy files, maybe it's cowboy related?
— Reply to this email directly or view it on GitHub https://github.com/rustyio/sync/issues/45#issuecomment-57948075.
Jesse Gumm Owner, Sigma Star Systems 414.940.4866 || sigma-star.com || @jessegumm
I'm getting an error that Module could not be loaded. This happens even if I only add a comment to the file. I can shutdown the server and restart it and the file works fine. Any tips on how to further diagnose the problem?
I'm new to rebar so I suspect I've missed some important configuration in how I added sync to my application. Thanks!
Here is the output in the console when I change a file: