<div dir="ltr">Hi all,<div>I used emysql to working with mysql in my Erlang Application. Sometimes, follwoing error come & need to restart application to working properly.</div><div><br></div><div><div>Else set_connection {{'EXIT',{failed_to_connect_to_database,emfile}},</div>
<div><div>=ERROR REPORT==== 2-Sep-2013::12:49:21 ===</div><div>File operation error: emfile. Target: ./lib.beam. Function: get_file. Process: code_server.</div><div><br></div><div>=ERROR REPORT==== 2-Sep-2013::12:49:21 ===</div>
<div>File operation error: emfile. Target: /opt/test_app/system/lib/kernel-2.14.1/ebin/lib.beam. Function: get_file. Process: code_server.</div><div><br></div><div>=ERROR REPORT==== 2-Sep-2013::12:49:21 ===</div><div>File operation error: emfile. Target: /opt/test_app/system/lib/stdlib-1.17.1/ebin/lib.beam. Function: get_file. Process: code_server.</div>
<div><br></div><div>=ERROR REPORT==== 2-Sep-2013::12:49:21 ===</div><div>File operation error: emfile. Target: /opt/test_app/system/lib/sasl-2.1.9.2/ebin/lib.beam. Function: get_file. Process: code_server.</div><div><br></div>
<div>=ERROR REPORT==== 2-Sep-2013::12:49:21 ===</div><div>File operation error: emfile. Target: /opt/test_app/system/lib/compiler-4.7.1/ebin/lib.beam. Function: get_file. Process: code_server.</div></div></div><div>Pls help to solve this.</div>
<div>Br,</div><div>Sanath</div><div><br></div><div><br></div><div>code :</div><div><br></div><div><div>case catch emysql:add_pool(ConnPoolId, Config#db_conn_data.pool_size, Config#db_conn_data.username, Config#db_conn_data.password, Config#db_conn_data.host, Config#db_conn_data.port, DbName, utf8) of</div>
<div><span class="" style="white-space:pre"> </span>ok -><span class="" style="white-space:pre"> </span></div><div><span class="" style="white-space:pre"> </span>{ok, ConnPoolId};</div><div><span class="" style="white-space:pre"> </span>{error, pool_already_exists} -></div>
<div><span class="" style="white-space:pre"> </span>already_exist;</div><div><span class="" style="white-space:pre"> </span>{'EXIT',{failed_to_connect_to_database, emfile}} -></div><div><span class="" style="white-space:pre"> </span><span style="background-color:rgb(255,255,0)">io:fwrite("Else set_connection ~p~n",[{{failed_to_connect_to_database, emfile}, DbName, ConnPoolId}]),</span></div>
<div><span class="" style="white-space:pre"> </span>catch spawn(?MODULE, update_status,["failed_to_connect_to_database"]),</div><div><span class="" style="white-space:pre"> </span>error;</div><div><span class="" style="white-space:pre"> </span>Else -></div>
<div><span class="" style="white-space:pre"> </span>catch spawn(?MODULE, update_status,["database_error"]),</div><div><span class="" style="white-space:pre"> </span>io:fwrite("Else set_connection ~p~n",[{Else, DbName, ConnPoolId}]),</div>
<div><span class="" style="white-space:pre"> </span>error</div><div><span class="" style="white-space:pre"> </span>end. </div></div></div>