金庆的专栏

  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  423 随笔 :: 0 文章 :: 454 评论 :: 0 Trackbacks
emysql add_poop() 超时出错

(金庆的专栏)

sample/a_hello.erl 连接本机更改为连接局域网内的MySql服务器:

    emysql:add_pool(hello_pool, [{size,1},
        {host, "192.168.1.2"},
        ...


编译运行时会出现超时退出:

D:\...\deps\emysql\samples>erl -pa ../ebin -s a_hello run -s init stop -noshell
add_pool...{"init terminating in do_boot",{{nocatch,{failed_to_recv_packet_header,timeout}},[{init,start_it,1,[{file,"init.erl"},{line,1062}]},{init,start_em,1,[{file,"init.erl"},{line,1034}]}]}}

Crash dump is being written to: erl_crash.dump...done
init terminating in do_boot ()

设置 default_timeout 参数为 10s 就可以成功:
D:\...\deps\emysql\samples>erl -pa ../ebin -s a_hello run -s init
 stop -noshell -emysql default_timeout 10000


查看代码,缺省的 default_timeout 为8s。
当MySql没有skip-name-resolve时,连接MySql需要近10秒才能连上,
所以很容易出现超时错误。

已提交问题:
https://github.com/Eonblast/Emysql/issues/174
posted on 2015-08-25 17:50 金庆 阅读(551) 评论(0)  编辑 收藏 引用 所属分类: 7. Erlang

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理