<div dir="ltr"><div class="gmail_quote">Serge, you are absolutely correct. My apologies. I was wrapping brackets around an element in the tuple instead of the whole tuple. I have a new error which I am looking into.<br><div dir="ltr">
<br>{error,<br>                                   {function_clause,<br>
                                    [{erlfs_store_worker_fsm,<br>                                      init,<br>                                      [{store_chunk,<div class="Ih2E3d"><br>                                        {chunk,<br>
                                         {chunk_meta,<br>
                                          {file_meta,<br>                                           "test123",<br>                                           "test.txt",<br>                                           0,<br>

                                           "text/plain",<br>                                           {{0,1,1},{0,0,0}}},<br>                                          0,<br>                                          0,<br>

                                          []},<br>                                         <<"Hello world!">>}}]},<br></div>                                     {gen_fsm,init_it,6},<div class="Ih2E3d">
<br>                                     {proc_lib,init_p,5}]}}<br>
<br></div><div><div></div><div class="Wj3C7c"><div class="gmail_quote">On Wed, Aug 20, 2008 at 11:04 AM, Serge Aleynikov <span dir="ltr"><<a href="mailto:saleyn@gmail.com" target="_blank">saleyn@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
The error you reported earlier:<br>
<br>
{'EXIT', {badarg, [{erlang, apply,<br>
    [erlfs_store_worker_fsm, start_link, {store_chunk, ...}]}]}}<br>
<br>
was a clear indication that erlang:apply(M,F,A) was called with A being a tuple rather than a list.  If this still doesn't work after replacing tuple with a list in the second argument of the supervisor:start_child/2 call, this means that you probably have other issues in the erlfs_store_worker_fsm:start_link/1 itself.<br>


<br>
I can't say anything more without seeing a more detailed error report.<br><font color="#888888">
<br>
Serge</font><div><div></div><div><br>
<br>
Matt Williamson wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Yes, I saw that in the docs. What I was saying is that calling apply(M, F,<br>
A++List) =:= apply(M, F, List) when A =:= [].<br>
<br>
I did try your suggestion anyway with the same results.<br>
<br>
On Wed, Aug 20, 2008 at 9:54 AM, Serge Aleynikov <<a href="mailto:saleyn@gmail.com" target="_blank">saleyn@gmail.com</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
What is the arity of erlfs_store_worker_fsm:start_link function?<br>
<br>
Not quite sure what you mean by [] ++ 1 below.<br>
<br>
The supervisor:start_child/2 takes a list [term()] as the second parameter.<br>
 Here's its docs:<br>
<br>
"If the case of a simple_one_for_one supervisor, the child specification<br>
defined in Module:init/1 will be used and ChildSpec should instead be an<br>
arbitrary list of terms List. The child process will then be started by<br>
appending List to the existing start function arguments, i.e. by calling<br>
apply(M, F, A++List) where {M,F,A} is the start function defined in the<br>
child specification."<br>
<br>
Note the A++List part.<br>
<br>
<br>
Matt Williamson wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I'm afraid that did not work. I am passing an empty list, and if I execute<br>
[] ++ 1 in the shell I get 1.<br>
<br>
On Wed, Aug 20, 2008 at 9:31 AM, Serge Aleynikov <<a href="mailto:saleyn@gmail.com" target="_blank">saleyn@gmail.com</a>><br>
wrote:<br>
<br>
 Try starting it as:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
supervisor:start_child(erlfs_store_worker_sup, [{store_chunk, Chunk}])<br>
<br>
The simple_one_for_one strategy appends the arguments passed to<br>
supervisor:start_child/2 to the list of args specified in the<br>
supervisor's<br>
spec.<br>
<br>
Serge<br>
<br>
Matt Williamson wrote:<br>
<br>
 Hello,<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I am starting a gen_fsm with<br>
supervisor:start_child(erlfs_store_worker_sup,<br>
{store_chunk, Chunk}) but I get the following error:<br>
<br>
{error,<br>
                                 {'EXIT',<br>
                                  {badarg,<br>
                                   [{erlang,<br>
                                     apply,<br>
                                     [erlfs_store_worker_fsm,<br>
                                      start_link,<br>
                                      {store_chunk,<br>
                                       {chunk,<br>
                                        {chunk_meta,<br>
                                         {file_meta,<br>
                                          "test123",<br>
                                          "test.txt",<br>
                                          0,<br>
                                          "text/plain",<br>
                                          {{0,1,1},{0,0,0}}},<br>
                                         0,<br>
                                         0,<br>
                                         []},<br>
                                        <<"Hello world!">>}}]},<br>
                                    {supervisor,do_start_child_i,3},<br>
                                    {supervisor,handle_call,3},<br>
                                    {gen_server,handle_msg,6},<br>
                                    {proc_lib,init_p,5}]}}}<br>
<br>
I've been trying to figure it out for a while, but I am having a hard<br>
time.<br>
Here is the Child Spec in the supervisor (erlfs_store_worker_sup):<br>
<br>
init(Args) -><br>
  WorkerSpec = {erlfs_store_worker_fsm, {erlfs_store_worker_fsm,<br>
                     start_link, []},<br>
        temporary, 2000, worker, [erlfs_store_worker_fsm]},<br>
  {ok,{{simple_one_for_one, 0, 1}, [WorkerSpec]}}.<br>
<br>
<br>
<br>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
<br>
<br>
</blockquote></blockquote></blockquote></blockquote>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div></div>
</div><br></div>