与 ErlyDTL Erlang 一起使用时同步崩溃

Sync crash when using with ErlyDTL Erlang

谁有想法或可以解决 Sync with ErlyDTL 的崩溃问题?

一旦我尝试使用通过 ErlyDTL 从模板呈现的页面,Sync 将崩溃并关闭应用程序。这是下面的日志:

=ERROR REPORT==== 30-Jul-2015::09:01:26 ===
** Generic server sync_scanner terminating 
** Last message in was {'$gen_cast',discover_src_dirs}
** When Server state == {state,
                            [cow_mimetypes,cowboy_rest,cowboy_static,
                             layout_main_dtl,erlydtl_dateformat,footer_dtl,
                             header_dtl,header_init_dtl,erlydtl_filters,
                             erlydtl_runtime,header_meta_dtl,template,
                             index_controller,jsx_parser,jsx_encoder,
                             jsx_to_json,ws_resource,helper,jsx_decoder,
                             jsx_config,jsx_to_term,jsx,cow_ws,
                             cowboy_websocket,cow_cookie,ws_handler,
                             cowboy_handler,cow_qs,cow_http_hd,cowboy_req,
                             cowboy_protocol,gproc_pool,gproc_bcast,
                             gproc_monitor,gproc_lib,gproc,gproc_sup,
                             gproc_app,websocket_sup,pgsql_binary,pgsql_types,
                             pgsql_sock,pgsql_connection,pgsql,pgsql_worker,
                             poolboy_sup,poolboy,pgsql_pool,config,session,
                             ranch_acceptor,ranch_acceptors_sup,
                             ranch_conns_sup,ranch_listener_sup,ranch_tcp,
                             ranch,cowboy,cowboy_router,websocket_app,
                             cowboy_clock,cowboy_sup,cowboy_app,sync_notify,
                             sync_utils,sync_scanner,sync_options,sync,
                             ranch_server,ranch_sup,ranch_app,erts_internal,
                             erlang,erl_prim_loader,prim_zip,zlib,prim_file,
                             prim_inet,prim_eval,init,otp_ring0],
                            ["/home/dev/bongthom/deps/ranch/src",
                             "/home/dev/bongthom/deps/sync/src"],
                            ["/home/dev/bongthom/deps/ranch/src/ranch.erl",
                             "/home/dev/bongthom/deps/ranch/src/ranch_acceptor.erl",
                             "/home/dev/bongthom/deps/ranch/src/ranch_acceptors_sup.erl",
                             "/home/dev/bongthom/deps/ranch/src/ranch_app.erl",
                             "/home/dev/bongthom/deps/ranch/src/ranch_conns_sup.erl",
                             "/home/dev/bongthom/deps/ranch/src/ranch_listener_sup.erl",
                             "/home/dev/bongthom/deps/ranch/src/ranch_protocol.erl",
                             "/home/dev/bongthom/deps/ranch/src/ranch_server.erl",
                             "/home/dev/bongthom/deps/ranch/src/ranch_ssl.erl",
                             "/home/dev/bongthom/deps/ranch/src/ranch_sup.erl",
                             "/home/dev/bongthom/deps/ranch/src/ranch_tcp.erl",
                             "/home/dev/bongthom/deps/ranch/src/ranch_transport.erl",
                             "/home/dev/bongthom/deps/sync/src/sync.erl",
                             "/home/dev/bongthom/deps/sync/src/sync_notify.erl", 
                             "/home/dev/bongthom/deps/sync/src/sync_options.erl",
                             "/home/dev/bongthom/deps/sync/src/sync_scanner.erl",
                             "/home/dev/bongthom/deps/sync/src/sync_utils.erl"], 
                            ["/home/dev/bongthom/deps/ranch/include",
                             "include"],
                            [],
                            [{erl_prim_loader,0},
                             {erlang,0},
                             {erts_internal,0},
                             {init,0},
                             {otp_ring0,0},
                             {prim_eval,0},
                             {prim_file,0},
                             {prim_inet,0},
                             {prim_zip,0},
                             {ranch_app,{{2015,7,27},{9,49,18}}},
                             {ranch_server,{{2015,7,27},{9,49,18}}},
                             {ranch_sup,{{2015,7,27},{9,49,18}}},
                             {sync,{{2015,7,30},{8,48,39}}},
                             {sync_notify,{{2015,7,30},{8,48,39}}},
                             {sync_options,{{2015,7,30},{8,48,39}}},
                             {sync_scanner,{{2015,7,30},{8,48,39}}},
                             {sync_utils,{{2015,7,30},{8,48,39}}},
                             {zlib,0}],
                            [{"/home/dev/bongthom/deps/ranch/src/ranch.erl",
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/ranch/src/ranch_acceptor.erl",
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/ranch/src/ranch_acceptors_sup.erl",
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/ranch/src/ranch_app.erl", 
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/ranch/src/ranch_conns_sup.erl",
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/ranch/src/ranch_listener_sup.erl",
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/ranch/src/ranch_protocol.erl",
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/ranch/src/ranch_server.erl",
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/ranch/src/ranch_ssl.erl", 
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/ranch/src/ranch_sup.erl", 
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/ranch/src/ranch_tcp.erl", 
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/ranch/src/ranch_transport.erl",
                              {{2015,7,27},{9,49,5}}},
                             {"/home/dev/bongthom/deps/sync/src/sync.erl",
                              {{2015,7,30},{8,48,11}}},
                             {"/home/dev/bongthom/deps/sync/src/sync_notify.erl",
                              {{2015,7,30},{8,48,11}}},
                             {"/home/dev/bongthom/deps/sync/src/sync_options.erl",
                              {{2015,7,30},{8,48,11}}},
                             {"/home/dev/bongthom/deps/sync/src/sync_scanner.erl",
                              {{2015,7,30},{8,48,11}}},
                             {"/home/dev/bongthom/deps/sync/src/sync_utils.erl", 
                              {{2015,7,30},{8,48,11}}}],
                            [],
                            [{discover_modules,{65537284,#Ref<0.0.2.1592>}},
                             {discover_src_dirs,{35630750,#Ref<0.0.1.215>}},
                             {discover_src_files,{35674499,#Ref<0.0.2.1437>}},
                             {compare_src_files,{35775288,#Ref<0.0.2.1589>}},
                             {compare_beams,{35750711,#Ref<0.0.2.1545>}},
                             {compare_hrl_files,{35750790,#Ref<0.0.2.1548>}}],
                            false,false}
** Reason for termination == 
** {{badmatch,undefined},
    [{sync_scanner,'-discover_source_dirs/2-fun-0-',2,
                   [{file,"src/sync_scanner.erl"},{line,729}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1262}]},
     {sync_scanner,discover_source_dirs,2,
                   [{file,"src/sync_scanner.erl"},{line,739}]},
     {gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,615}]},
     {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,681}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}
Scanning source files...
Scanning source files...

=ERROR REPORT==== 30-Jul-2015::09:01:26 ===
** Generic server sync_scanner terminating 
** Last message in was {'$gen_cast',discover_src_dirs}
** When Server state == {state,
                            [cow_mimetypes,cowboy_rest,cowboy_static,
                             layout_main_dtl,erlydtl_dateformat,footer_dtl,
                             header_dtl,header_init_dtl,erlydtl_filters,
                             erlydtl_runtime,header_meta_dtl,template,
                             index_controller,jsx_parser,jsx_encoder,
                             jsx_to_json,ws_resource,helper,jsx_decoder,
                             jsx_config,jsx_to_term,jsx,cow_ws,
                             cowboy_websocket,cow_cookie,ws_handler,
                             cowboy_handler,cow_qs,cow_http_hd,cowboy_req,
                             cowboy_protocol,gproc_pool,gproc_bcast,
                             gproc_monitor,gproc_lib,gproc,gproc_sup,
                             gproc_app,websocket_sup,pgsql_binary,pgsql_types,
                             pgsql_sock,pgsql_connection,pgsql,pgsql_worker,
                             poolboy_sup,poolboy,pgsql_pool,config,session,
                             ranch_acceptor,ranch_acceptors_sup,
                             ranch_conns_sup,ranch_listener_sup,ranch_tcp,
                             ranch,cowboy,cowboy_router,websocket_app,
                             cowboy_clock,cowboy_sup,cowboy_app,sync_notify,
                             sync_utils,sync_scanner,sync_options,sync,
                             ranch_server,ranch_sup,ranch_app,erts_internal,
                             erlang,erl_prim_loader,prim_zip,zlib,prim_file,
                             prim_inet,prim_eval,init,otp_ring0],
                            [],[],[],[],undefined,[],[],
                            [{discover_modules,{65722875,#Ref<0.0.2.1722>}}],
                            false,false}
** Reason for termination == 
** {{badmatch,undefined},
    [{sync_scanner,'-discover_source_dirs/2-fun-0-',2,
                   [{file,"src/sync_scanner.erl"},{line,729}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1262}]},
     {sync_scanner,discover_source_dirs,2,
                   [{file,"src/sync_scanner.erl"},{line,739}]},
     {gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,615}]},
     {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,681}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}
Scanning source files...

=ERROR REPORT==== 30-Jul-2015::09:01:26 ===
** Generic server sync_scanner terminating 
** Last message in was {'$gen_cast',discover_src_dirs}
** When Server state == {state,
                            [cow_mimetypes,cowboy_rest,cowboy_static,
                             layout_main_dtl,erlydtl_dateformat,footer_dtl,
                             header_dtl,header_init_dtl,erlydtl_filters,
                             erlydtl_runtime,header_meta_dtl,template,
                             index_controller,jsx_parser,jsx_encoder,
                             jsx_to_json,ws_resource,helper,jsx_decoder,
                             jsx_config,jsx_to_term,jsx,cow_ws,
                             cowboy_websocket,cow_cookie,ws_handler,
                             cowboy_handler,cow_qs,cow_http_hd,cowboy_req,
                             cowboy_protocol,gproc_pool,gproc_bcast,
                             gproc_monitor,gproc_lib,gproc,gproc_sup,
                             gproc_app,websocket_sup,pgsql_binary,pgsql_types,
                             pgsql_sock,pgsql_connection,pgsql,pgsql_worker,
                             poolboy_sup,poolboy,pgsql_pool,config,session,
                             ranch_acceptor,ranch_acceptors_sup,
                             ranch_conns_sup,ranch_listener_sup,ranch_tcp,
                             ranch,cowboy,cowboy_router,websocket_app,
                             cowboy_clock,cowboy_sup,cowboy_app,sync_notify,
                             sync_utils,sync_scanner,sync_options,sync,
                             ranch_server,ranch_sup,ranch_app,erts_internal,
                             erlang,erl_prim_loader,prim_zip,zlib,prim_file,
                             prim_inet,prim_eval,init,otp_ring0],
                            [],[],[],[],undefined,[],[],
                            [{discover_modules,{65769266,#Ref<0.0.2.1851>}}],
                            false,false}
** Reason for termination == 
** {{badmatch,undefined},
    [{sync_scanner,'-discover_source_dirs/2-fun-0-',2,
                   [{file,"src/sync_scanner.erl"},{line,729}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1262}]},
     {sync_scanner,discover_source_dirs,2,
                   [{file,"src/sync_scanner.erl"},{line,739}]},
     {gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,615}]},
     {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,681}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}
Scanning source files...

=ERROR REPORT==== 30-Jul-2015::09:01:26 ===
** Generic server sync_scanner terminating 
** Last message in was {'$gen_cast',discover_src_dirs}
** When Server state == {state,
                            [cow_mimetypes,cowboy_rest,cowboy_static,
                             layout_main_dtl,erlydtl_dateformat,footer_dtl,
                             header_dtl,header_init_dtl,erlydtl_filters,
                             erlydtl_runtime,header_meta_dtl,template,
                             index_controller,jsx_parser,jsx_encoder,
                             jsx_to_json,ws_resource,helper,jsx_decoder,
                             jsx_config,jsx_to_term,jsx,cow_ws,
                             cowboy_websocket,cow_cookie,ws_handler,
                             cowboy_handler,cow_qs,cow_http_hd,cowboy_req,
                             cowboy_protocol,gproc_pool,gproc_bcast,
                             gproc_monitor,gproc_lib,gproc,gproc_sup,
                             gproc_app,websocket_sup,pgsql_binary,pgsql_types,
                             pgsql_sock,pgsql_connection,pgsql,pgsql_worker,
                             poolboy_sup,poolboy,pgsql_pool,config,session,
                             ranch_acceptor,ranch_acceptors_sup,
                             ranch_conns_sup,ranch_listener_sup,ranch_tcp,
                             ranch,cowboy,cowboy_router,websocket_app,
                             cowboy_clock,cowboy_sup,cowboy_app,sync_notify,
                             sync_utils,sync_scanner,sync_options,sync,
                             ranch_server,ranch_sup,ranch_app,erts_internal,
                             erlang,erl_prim_loader,prim_zip,zlib,prim_file,
                             prim_inet,prim_eval,init,otp_ring0],
                            [],[],[],[],undefined,[],[],
                            [{discover_modules,{65812427,#Ref<0.0.2.1980>}}],
                            false,false}
** Reason for termination == 
** {{badmatch,undefined},
    [{sync_scanner,'-discover_source_dirs/2-fun-0-',2,
                   [{file,"src/sync_scanner.erl"},{line,729}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1262}]},
     {sync_scanner,discover_source_dirs,2,
                   [{file,"src/sync_scanner.erl"},{line,739}]},
     {gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,615}]},
     {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,681}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}
Scanning source files...

=ERROR REPORT==== 30-Jul-2015::09:01:26 ===
** Generic server sync_scanner terminating 
** Last message in was {'$gen_cast',discover_src_dirs}
** When Server state == {state,
                            [cow_mimetypes,cowboy_rest,cowboy_static,
                             layout_main_dtl,erlydtl_dateformat,footer_dtl,
                             header_dtl,header_init_dtl,erlydtl_filters,
                             erlydtl_runtime,header_meta_dtl,template,
                             index_controller,jsx_parser,jsx_encoder,
                             jsx_to_json,ws_resource,helper,jsx_decoder,
                             jsx_config,jsx_to_term,jsx,cow_ws,
                             cowboy_websocket,cow_cookie,ws_handler,
                             cowboy_handler,cow_qs,cow_http_hd,cowboy_req,
                             cowboy_protocol,gproc_pool,gproc_bcast,
                             gproc_monitor,gproc_lib,gproc,gproc_sup,
                             gproc_app,websocket_sup,pgsql_binary,pgsql_types,
                             pgsql_sock,pgsql_connection,pgsql,pgsql_worker,
                             poolboy_sup,poolboy,pgsql_pool,config,session,
                             ranch_acceptor,ranch_acceptors_sup,
                             ranch_conns_sup,ranch_listener_sup,ranch_tcp,
                             ranch,cowboy,cowboy_router,websocket_app,
                             cowboy_clock,cowboy_sup,cowboy_app,sync_notify,
                             sync_utils,sync_scanner,sync_options,sync,
                             ranch_server,ranch_sup,ranch_app,erts_internal,
                             erlang,erl_prim_loader,prim_zip,zlib,prim_file,
                             prim_inet,prim_eval,init,otp_ring0],
                            [],[],[],[],undefined,[],[],
                            [{discover_modules,{65877681,#Ref<0.0.2.2109>}}],
                            false,false}
** Reason for termination == 
** {{badmatch,undefined},
    [{sync_scanner,'-discover_source_dirs/2-fun-0-',2,
                   [{file,"src/sync_scanner.erl"},{line,729}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1262}]},
     {sync_scanner,discover_source_dirs,2,
                   [{file,"src/sync_scanner.erl"},{line,739}]},
     {gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,615}]},
     {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,681}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}

=ERROR REPORT==== 30-Jul-2015::09:01:26 ===
** Generic server sync_scanner terminating 
** Last message in was {'$gen_cast',discover_src_dirs}
** When Server state == {state,
                            [cow_mimetypes,cowboy_rest,cowboy_static,
                             layout_main_dtl,erlydtl_dateformat,footer_dtl,
                             header_dtl,header_init_dtl,erlydtl_filters,
                             erlydtl_runtime,header_meta_dtl,template,
                             index_controller,jsx_parser,jsx_encoder,
                             jsx_to_json,ws_resource,helper,jsx_decoder,
                             jsx_config,jsx_to_term,jsx,cow_ws,
                             cowboy_websocket,cow_cookie,ws_handler,
                             cowboy_handler,cow_qs,cow_http_hd,cowboy_req,
                             cowboy_protocol,gproc_pool,gproc_bcast,
                             gproc_monitor,gproc_lib,gproc,gproc_sup,
                             gproc_app,websocket_sup,pgsql_binary,pgsql_types,
                             pgsql_sock,pgsql_connection,pgsql,pgsql_worker,
                             poolboy_sup,poolboy,pgsql_pool,config,session,
                             ranch_acceptor,ranch_acceptors_sup,
                             ranch_conns_sup,ranch_listener_sup,ranch_tcp,
                             ranch,cowboy,cowboy_router,websocket_app,
                             cowboy_clock,cowboy_sup,cowboy_app,sync_notify,
                             sync_utils,sync_scanner,sync_options,sync,
                             ranch_server,ranch_sup,ranch_app,erts_internal,
                             erlang,erl_prim_loader,prim_zip,zlib,prim_file,
                             prim_inet,prim_eval,init,otp_ring0],
                            [],[],[],[],undefined,[],[],
                            [{discover_modules,{65930706,#Ref<0.0.2.2238>}}],
                            false,false}
** Reason for termination == 
** {{badmatch,undefined},
    [{sync_scanner,'-discover_source_dirs/2-fun-0-',2,
                   [{file,"src/sync_scanner.erl"},{line,729}]},
     {lists,foldl,3,[{file,"lists.erl"},{line,1262}]},
     {sync_scanner,discover_source_dirs,2,
                   [{file,"src/sync_scanner.erl"},{line,739}]},
     {gen_server,try_dispatch,4,[{file,"gen_server.erl"},{line,615}]},
     {gen_server,handle_msg,5,[{file,"gen_server.erl"},{line,681}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}

=INFO REPORT==== 30-Jul-2015::09:01:26 ===
    application: sync
    exited: shutdown
    type: permanent
{"Kernel pid terminated",application_controller,"{application_terminated,sync,shutdown}"}

Crash dump is being written to: erl_crash.dump...done
Kernel pid terminated (application_controller) ({application_terminated,sync,shutdown})

我已经通过更改处理 src/sync_scanner.erl 和 src/sync_utils.erl 中的 DTL 文件的方式修复了它 – Yarin Nim 昨天