You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Hannes Baldursson <ha...@gmail.com> on 2008/10/30 22:05:42 UTC

Don't get it (Erlang)

Hi all,

I'm having some troubles with the Erlang generated code from Thrift. I might
add that I'm a newbie in using Thrift and got minimal knowledge about Erlang
but I'm fairly experienced in programming.

I've been looking at the tutorial where in one directory "tutorial/erl/"
there are files called "server.erl" and "server.sh" that seem to be an
implementation of the RPC functions. Am I missing something or doesn't
Thrift generate server stubs based on my definition file?

All the generated files I see are in the gen-erl and I can't see that any
one of them do what server.erl does... am I missing something or do I have
to hand code the "server.erl" file

btw, I will make sure to add your points into the wiki page

Thanks in advance,
Hannes Baldursson

Re: Don't get it (Erlang)

Posted by Hannes Baldursson <ha...@gmail.com>.
Never mind I figured it out.

I'm going to hack this until I understand it better and then write about it
on the wiki :)


On Fri, Oct 31, 2008 at 10:49, Hannes Baldursson <ha...@gmail.com> wrote:

> I've been looking into the skeleton app, it's awesome - I owe you one!
>
> But I'm having 2 problems.
>
> 1. Where should I place the erlang files generated by Thrift?
> (RPC_DIR=../../if)
> 2. Where should I place the Thrift modules?
>
> Like I said I'm new to erlang and thrift and I've got a hard time wrapping
> my head around it because of the limited documentation.
>
> Thanks in advance,
> Hannes
>
>
> On Thu, Oct 30, 2008 at 21:12, Suhail Doshi <di...@gmail.com>wrote:
>
>> Hannes Baldursson wrote:
>>
>>> Hi all,
>>>
>>> I'm having some troubles with the Erlang generated code from Thrift. I
>>> might
>>> add that I'm a newbie in using Thrift and got minimal knowledge about
>>> Erlang
>>> but I'm fairly experienced in programming.
>>>
>>> I've been looking at the tutorial where in one directory "tutorial/erl/"
>>> there are files called "server.erl" and "server.sh" that seem to be an
>>> implementation of the RPC functions. Am I missing something or doesn't
>>> Thrift generate server stubs based on my definition file?
>>>
>>> All the generated files I see are in the gen-erl and I can't see that any
>>> one of them do what server.erl does... am I missing something or do I
>>> have
>>> to hand code the "server.erl" file
>>>
>>> btw, I will make sure to add your points into the wiki page
>>>
>>> Thanks in advance,
>>> Hannes Baldursson
>>>
>>>
>>>
>> Hi Hannes,
>>
>> I am very new to thrift too, just started hacking away at it last week.
>> Fortunately I was lucky to be friends with Todd Lipcon who made the Erlang
>> bindings for Thrift in the first place. Something very useful is:
>>
>> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>>
>> Play around and check it out, should give you a great stepping stone. You
>> might get stuck make the erlang app, make sure to check where your rpc
>> directory is pointing to in gen/Makefile.
>>
>> Suhail
>>
>
>

Re: Don't get it (Erlang)

Posted by Hannes Baldursson <ha...@gmail.com>.
I've been looking into the skeleton app, it's awesome - I owe you one!

But I'm having 2 problems.

1. Where should I place the erlang files generated by Thrift?
(RPC_DIR=../../if)
2. Where should I place the Thrift modules?

Like I said I'm new to erlang and thrift and I've got a hard time wrapping
my head around it because of the limited documentation.

Thanks in advance,
Hannes


On Thu, Oct 30, 2008 at 21:12, Suhail Doshi <di...@gmail.com>wrote:

> Hannes Baldursson wrote:
>
>> Hi all,
>>
>> I'm having some troubles with the Erlang generated code from Thrift. I
>> might
>> add that I'm a newbie in using Thrift and got minimal knowledge about
>> Erlang
>> but I'm fairly experienced in programming.
>>
>> I've been looking at the tutorial where in one directory "tutorial/erl/"
>> there are files called "server.erl" and "server.sh" that seem to be an
>> implementation of the RPC functions. Am I missing something or doesn't
>> Thrift generate server stubs based on my definition file?
>>
>> All the generated files I see are in the gen-erl and I can't see that any
>> one of them do what server.erl does... am I missing something or do I have
>> to hand code the "server.erl" file
>>
>> btw, I will make sure to add your points into the wiki page
>>
>> Thanks in advance,
>> Hannes Baldursson
>>
>>
>>
> Hi Hannes,
>
> I am very new to thrift too, just started hacking away at it last week.
> Fortunately I was lucky to be friends with Todd Lipcon who made the Erlang
> bindings for Thrift in the first place. Something very useful is:
>
> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>
> Play around and check it out, should give you a great stepping stone. You
> might get stuck make the erlang app, make sure to check where your rpc
> directory is pointing to in gen/Makefile.
>
> Suhail
>

Re: Don't get it (Erlang)

Posted by Hannes Baldursson <ha...@gmail.com>.
Thanks a lot for your input! And to be honest I sometimes need to babied :D

I appreciate it, really!


On Fri, Oct 31, 2008 at 18:10, Suhail Doshi <di...@gmail.com>wrote:

> Hannes Baldursson wrote:
>
>> Whoops I'm still in trouble...
>>
>> I've made great progress though... I've figured out HOW to use the
>> skeleton
>> app generator, I've figured out where to place my definition files and the
>> Erlang lib for thrift. I've managed to make the erlang server app (haven't
>> added any code so far).  I got the server running but it crashed and I
>> wasn't able to connect to it via a PHP client (Connection refused).
>>
>> In short I need a proof of concept server that I can call function foo()
>> and
>> get the string "bar" back to the client.
>>
>> Could you give me a hand?
>>
>> Thanks in advance,
>> Hannes Balduesson
>>
>> Here's a dump of what erlang gives me. What am I doing wrong?
>>
>>
>> Eshell V5.5.5  (abort with ^G)
>> (session@hannson-test)1>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_safe_sup}
>>             started: [{pid,<0.45.0>},
>>                       {name,alarm_handler},
>>                       {mfa,{alarm_handler,start_link,[]}},
>>                       {restart_type,permanent},
>>                       {shutdown,2000},
>>                       {child_type,worker}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_safe_sup}
>>             started: [{pid,<0.46.0>},
>>                       {name,overload},
>>                       {mfa,{overload,start_link,[]}},
>>                       {restart_type,permanent},
>>                       {shutdown,2000},
>>                       {child_type,worker}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_sup}
>>             started: [{pid,<0.44.0>},
>>                       {name,sasl_safe_sup},
>>                       {mfa,
>>                           {supervisor,
>>                               start_link,
>>                               [{local,sasl_safe_sup},sasl,safe]}},
>>                       {restart_type,permanent},
>>                       {shutdown,infinity},
>>                       {child_type,supervisor}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_sup}
>>             started: [{pid,<0.47.0>},
>>                       {name,release_handler},
>>                       {mfa,{release_handler,start_link,[]}},
>>                       {restart_type,permanent},
>>                       {shutdown,2000},
>>                       {child_type,worker}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>         application: sasl
>>          started_at: 'session@hannson-test'
>>
>> =SUPERVISOR REPORT==== 31-Oct-2008::12:27:36 ===
>>     Supervisor: {local,session_sup}
>>     Context:    start_error
>>     Reason:     {'EXIT',
>>                     {undef,
>>                         [{thrift_server,
>>                              start_link,
>>                              [8080,sessionServer_thrift,session_service]},
>>                          {supervisor,do_start_child,2},
>>                          {supervisor,start_children,3},
>>                          {supervisor,init_children,2},
>>                          {gen_server,init_it,6},
>>                          {proc_lib,init_p,5}]}}
>>     Offender:   [{pid,undefined},
>>                  {name,session_service},
>>                  {mfa,{session_service,start_link,[]}},
>>                  {restart_type,permanent},
>>                  {shutdown,2000},
>>                  {child_type,worker}]
>>
>> =CRASH REPORT==== 31-Oct-2008::12:27:36 ===
>>  crasher:
>>    pid: <0.51.0>
>>    registered_name: []
>>    error_info: {shutdown,{session_app,start,[normal,[]]}}
>>    initial_call: {application_master,
>>                     init,
>>                     [<0.5.0>,
>>                      <0.50.0>,
>>                      {appl_data,
>>                          session,
>>                          [],
>>                          undefined,
>>                          {session_app,[]},
>>                          ["session_app","session_sup","session_service"],
>>                          [],
>>                          infinity,
>>                          infinity},
>>                      normal]}
>>    ancestors: [<0.50.0>]
>>    messages: [{'EXIT',<0.52.0>,normal}]
>>    links: [<0.50.0>,<0.5.0>]
>>    dictionary: []
>>    trap_exit: true
>>    status: running
>>    heap_size: 610
>>    stack_size: 21
>>    reductions: 2058
>>  neighbours:
>>
>> =INFO REPORT==== 31-Oct-2008::12:27:36 ===
>>    application: session
>>    exited: {shutdown,{session_app,start,[normal,[]]}}
>>    type: temporary
>>
>>
>>
>> On Thu, Oct 30, 2008 at 21:12, Suhail Doshi <digitalwarfare@gmail.com
>> >wrote:
>>
>>
>>
>>> Hannes Baldursson wrote:
>>>
>>>
>>>
>>>> Hi all,
>>>>
>>>> I'm having some troubles with the Erlang generated code from Thrift. I
>>>> might
>>>> add that I'm a newbie in using Thrift and got minimal knowledge about
>>>> Erlang
>>>> but I'm fairly experienced in programming.
>>>>
>>>> I've been looking at the tutorial where in one directory "tutorial/erl/"
>>>> there are files called "server.erl" and "server.sh" that seem to be an
>>>> implementation of the RPC functions. Am I missing something or doesn't
>>>> Thrift generate server stubs based on my definition file?
>>>>
>>>> All the generated files I see are in the gen-erl and I can't see that
>>>> any
>>>> one of them do what server.erl does... am I missing something or do I
>>>> have
>>>> to hand code the "server.erl" file
>>>>
>>>> btw, I will make sure to add your points into the wiki page
>>>>
>>>> Thanks in advance,
>>>> Hannes Baldursson
>>>>
>>>>
>>>>
>>>>
>>>>
>>> Hi Hannes,
>>>
>>> I am very new to thrift too, just started hacking away at it last week.
>>> Fortunately I was lucky to be friends with Todd Lipcon who made the
>>> Erlang
>>> bindings for Thrift in the first place. Something very useful is:
>>>
>>> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>>>
>>> Play around and check it out, should give you a great stepping stone. You
>>> might get stuck make the erlang app, make sure to check where your rpc
>>> directory is pointing to in gen/Makefile.
>>>
>>> Suhail
>>>
>>>
>>>
>>
>>
>>
> Sure, I can pass on the wealth of knowledge:
>
> Download this:
>
> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>
>
> First thing you want to do is execute that perl script so
> do:./make_new_thrift.pl example Example 9090
>
> example - This is name of your thrift file without the extension, a thrift
> file should be in the same directory as the perl script
> Example - Probably the class level name
> 9090 - port feel free to change it
>
> Make sure you've taken the lib/erl/ directory in the thrift source code and
> place it in the same directory as the thrift_skel. Run make on it, we need
> it compiled for this to work.
>
>
> Next make an rpc directory somewhere, I made mine a directory *above* where
> my thrift_skel, thrift directories are. Call it whatever you want, I called
> mine /rpc/. Now you want to edit /example/gen/Makefile. And change the path
> of RPC_DIR to where you actually have it or you will definitely run into
> errors.
>
> Now it's fun time, go into your example/src/ and start editting your
> example_service.erl with any function you want, remember to export it. A
> simple one would be: add(A,B) -> A+B.
> The export at the top of the file below handler_function one would be:
> add/2
>
> Jump back into root directory of your example folder, not the src folder.
> Run make. Everytime you change code, you must run make but you do not have
> to restart your service, Todd made it awesome with code reloading, we'll go
> into that.
>
> Now run: sudo ./start_example.sh and the service should start running with
> a pseudo console for you to reload code and even test your own service.
> Press enter and type: example_service:add(1,3).
>
> Hopefully it works and you see the output of the result.
>
> Sorry if I am babying people in this mailing list, I know some of you could
> code erlang circles around me but it's geared to people who have no idea
> what they are doing. Anyway, enjoy. Don't thank me, thank Todd Lipcon who
> made this and endured a few hours here and there helping me. =)
>
> Sincerely,
> Suhail Doshi
>

Re: Don't get it (Erlang)

Posted by Suhail Doshi <di...@gmail.com>.
Hi Hannes,

check /src/logging.app.src, should be able to change the port there, you 
probably specified a different one.

Or just fgrep "service_port"

Suhail

Hannes Baldursson wrote:
> Hey Suahail,
>
> I'm still having some troubles with the erlang server.
>
> It compiles and runs without problems. How ever it doesn't seem to listen to
> a port. When I use the PHP client I get a TException: TSocket: Could not
> connect to localhost:8080 (Connection refused [111]). I created the skeleton
> with 8080 as the port.
>
> In the pseudo console for the server I do not get a crash report like before
> and it seems to be working but I'm missing something. I run the server with
> "sudo ./start_session.sh"
>
> When I type "netstat -a | grep 8080" it returns nothing.
>
> I've followed your example and created an add(A,B) function in
> session_service.erl and in the pseudo console of the service I get a correct
> return value.
>
> Where is my error?
>
>
> On Fri, Oct 31, 2008 at 18:10, Suhail Doshi <di...@gmail.com>wrote:
>
>   
>> Hannes Baldursson wrote:
>>
>>     
>>> Whoops I'm still in trouble...
>>>
>>> I've made great progress though... I've figured out HOW to use the
>>> skeleton
>>> app generator, I've figured out where to place my definition files and the
>>> Erlang lib for thrift. I've managed to make the erlang server app (haven't
>>> added any code so far).  I got the server running but it crashed and I
>>> wasn't able to connect to it via a PHP client (Connection refused).
>>>
>>> In short I need a proof of concept server that I can call function foo()
>>> and
>>> get the string "bar" back to the client.
>>>
>>> Could you give me a hand?
>>>
>>> Thanks in advance,
>>> Hannes Balduesson
>>>
>>> Here's a dump of what erlang gives me. What am I doing wrong?
>>>
>>>
>>> Eshell V5.5.5  (abort with ^G)
>>> (session@hannson-test)1>
>>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>>          supervisor: {local,sasl_safe_sup}
>>>             started: [{pid,<0.45.0>},
>>>                       {name,alarm_handler},
>>>                       {mfa,{alarm_handler,start_link,[]}},
>>>                       {restart_type,permanent},
>>>                       {shutdown,2000},
>>>                       {child_type,worker}]
>>>
>>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>>          supervisor: {local,sasl_safe_sup}
>>>             started: [{pid,<0.46.0>},
>>>                       {name,overload},
>>>                       {mfa,{overload,start_link,[]}},
>>>                       {restart_type,permanent},
>>>                       {shutdown,2000},
>>>                       {child_type,worker}]
>>>
>>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>>          supervisor: {local,sasl_sup}
>>>             started: [{pid,<0.44.0>},
>>>                       {name,sasl_safe_sup},
>>>                       {mfa,
>>>                           {supervisor,
>>>                               start_link,
>>>                               [{local,sasl_safe_sup},sasl,safe]}},
>>>                       {restart_type,permanent},
>>>                       {shutdown,infinity},
>>>                       {child_type,supervisor}]
>>>
>>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>>          supervisor: {local,sasl_sup}
>>>             started: [{pid,<0.47.0>},
>>>                       {name,release_handler},
>>>                       {mfa,{release_handler,start_link,[]}},
>>>                       {restart_type,permanent},
>>>                       {shutdown,2000},
>>>                       {child_type,worker}]
>>>
>>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>>         application: sasl
>>>          started_at: 'session@hannson-test'
>>>
>>> =SUPERVISOR REPORT==== 31-Oct-2008::12:27:36 ===
>>>     Supervisor: {local,session_sup}
>>>     Context:    start_error
>>>     Reason:     {'EXIT',
>>>                     {undef,
>>>                         [{thrift_server,
>>>                              start_link,
>>>                              [8080,sessionServer_thrift,session_service]},
>>>                          {supervisor,do_start_child,2},
>>>                          {supervisor,start_children,3},
>>>                          {supervisor,init_children,2},
>>>                          {gen_server,init_it,6},
>>>                          {proc_lib,init_p,5}]}}
>>>     Offender:   [{pid,undefined},
>>>                  {name,session_service},
>>>                  {mfa,{session_service,start_link,[]}},
>>>                  {restart_type,permanent},
>>>                  {shutdown,2000},
>>>                  {child_type,worker}]
>>>
>>> =CRASH REPORT==== 31-Oct-2008::12:27:36 ===
>>>  crasher:
>>>    pid: <0.51.0>
>>>    registered_name: []
>>>    error_info: {shutdown,{session_app,start,[normal,[]]}}
>>>    initial_call: {application_master,
>>>                     init,
>>>                     [<0.5.0>,
>>>                      <0.50.0>,
>>>                      {appl_data,
>>>                          session,
>>>                          [],
>>>                          undefined,
>>>                          {session_app,[]},
>>>                          ["session_app","session_sup","session_service"],
>>>                          [],
>>>                          infinity,
>>>                          infinity},
>>>                      normal]}
>>>    ancestors: [<0.50.0>]
>>>    messages: [{'EXIT',<0.52.0>,normal}]
>>>    links: [<0.50.0>,<0.5.0>]
>>>    dictionary: []
>>>    trap_exit: true
>>>    status: running
>>>    heap_size: 610
>>>    stack_size: 21
>>>    reductions: 2058
>>>  neighbours:
>>>
>>> =INFO REPORT==== 31-Oct-2008::12:27:36 ===
>>>    application: session
>>>    exited: {shutdown,{session_app,start,[normal,[]]}}
>>>    type: temporary
>>>
>>>
>>>
>>> On Thu, Oct 30, 2008 at 21:12, Suhail Doshi <digitalwarfare@gmail.com
>>>       
>>>> wrote:
>>>>         
>>>
>>>       
>>>> Hannes Baldursson wrote:
>>>>
>>>>
>>>>
>>>>         
>>>>> Hi all,
>>>>>
>>>>> I'm having some troubles with the Erlang generated code from Thrift. I
>>>>> might
>>>>> add that I'm a newbie in using Thrift and got minimal knowledge about
>>>>> Erlang
>>>>> but I'm fairly experienced in programming.
>>>>>
>>>>> I've been looking at the tutorial where in one directory "tutorial/erl/"
>>>>> there are files called "server.erl" and "server.sh" that seem to be an
>>>>> implementation of the RPC functions. Am I missing something or doesn't
>>>>> Thrift generate server stubs based on my definition file?
>>>>>
>>>>> All the generated files I see are in the gen-erl and I can't see that
>>>>> any
>>>>> one of them do what server.erl does... am I missing something or do I
>>>>> have
>>>>> to hand code the "server.erl" file
>>>>>
>>>>> btw, I will make sure to add your points into the wiki page
>>>>>
>>>>> Thanks in advance,
>>>>> Hannes Baldursson
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> Hi Hannes,
>>>>
>>>> I am very new to thrift too, just started hacking away at it last week.
>>>> Fortunately I was lucky to be friends with Todd Lipcon who made the
>>>> Erlang
>>>> bindings for Thrift in the first place. Something very useful is:
>>>>
>>>> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>>>>
>>>> Play around and check it out, should give you a great stepping stone. You
>>>> might get stuck make the erlang app, make sure to check where your rpc
>>>> directory is pointing to in gen/Makefile.
>>>>
>>>> Suhail
>>>>
>>>>
>>>>
>>>>         
>>>
>>>       
>> Sure, I can pass on the wealth of knowledge:
>>
>> Download this:
>>
>> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>>
>>
>> First thing you want to do is execute that perl script so
>> do:./make_new_thrift.pl example Example 9090
>>
>> example - This is name of your thrift file without the extension, a thrift
>> file should be in the same directory as the perl script
>> Example - Probably the class level name
>> 9090 - port feel free to change it
>>
>> Make sure you've taken the lib/erl/ directory in the thrift source code and
>> place it in the same directory as the thrift_skel. Run make on it, we need
>> it compiled for this to work.
>>
>>
>> Next make an rpc directory somewhere, I made mine a directory *above* where
>> my thrift_skel, thrift directories are. Call it whatever you want, I called
>> mine /rpc/. Now you want to edit /example/gen/Makefile. And change the path
>> of RPC_DIR to where you actually have it or you will definitely run into
>> errors.
>>
>> Now it's fun time, go into your example/src/ and start editting your
>> example_service.erl with any function you want, remember to export it. A
>> simple one would be: add(A,B) -> A+B.
>> The export at the top of the file below handler_function one would be:
>> add/2
>>
>> Jump back into root directory of your example folder, not the src folder.
>> Run make. Everytime you change code, you must run make but you do not have
>> to restart your service, Todd made it awesome with code reloading, we'll go
>> into that.
>>
>> Now run: sudo ./start_example.sh and the service should start running with
>> a pseudo console for you to reload code and even test your own service.
>> Press enter and type: example_service:add(1,3).
>>
>> Hopefully it works and you see the output of the result.
>>
>> Sorry if I am babying people in this mailing list, I know some of you could
>> code erlang circles around me but it's geared to people who have no idea
>> what they are doing. Anyway, enjoy. Don't thank me, thank Todd Lipcon who
>> made this and endured a few hours here and there helping me. =)
>>
>> Sincerely,
>> Suhail Doshi
>>
>>     
>
>   


Re: Don't get it (Erlang)

Posted by Hannes Baldursson <ha...@gmail.com>.
Hey Suahail,

I'm still having some troubles with the erlang server.

It compiles and runs without problems. How ever it doesn't seem to listen to
a port. When I use the PHP client I get a TException: TSocket: Could not
connect to localhost:8080 (Connection refused [111]). I created the skeleton
with 8080 as the port.

In the pseudo console for the server I do not get a crash report like before
and it seems to be working but I'm missing something. I run the server with
"sudo ./start_session.sh"

When I type "netstat -a | grep 8080" it returns nothing.

I've followed your example and created an add(A,B) function in
session_service.erl and in the pseudo console of the service I get a correct
return value.

Where is my error?


On Fri, Oct 31, 2008 at 18:10, Suhail Doshi <di...@gmail.com>wrote:

> Hannes Baldursson wrote:
>
>> Whoops I'm still in trouble...
>>
>> I've made great progress though... I've figured out HOW to use the
>> skeleton
>> app generator, I've figured out where to place my definition files and the
>> Erlang lib for thrift. I've managed to make the erlang server app (haven't
>> added any code so far).  I got the server running but it crashed and I
>> wasn't able to connect to it via a PHP client (Connection refused).
>>
>> In short I need a proof of concept server that I can call function foo()
>> and
>> get the string "bar" back to the client.
>>
>> Could you give me a hand?
>>
>> Thanks in advance,
>> Hannes Balduesson
>>
>> Here's a dump of what erlang gives me. What am I doing wrong?
>>
>>
>> Eshell V5.5.5  (abort with ^G)
>> (session@hannson-test)1>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_safe_sup}
>>             started: [{pid,<0.45.0>},
>>                       {name,alarm_handler},
>>                       {mfa,{alarm_handler,start_link,[]}},
>>                       {restart_type,permanent},
>>                       {shutdown,2000},
>>                       {child_type,worker}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_safe_sup}
>>             started: [{pid,<0.46.0>},
>>                       {name,overload},
>>                       {mfa,{overload,start_link,[]}},
>>                       {restart_type,permanent},
>>                       {shutdown,2000},
>>                       {child_type,worker}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_sup}
>>             started: [{pid,<0.44.0>},
>>                       {name,sasl_safe_sup},
>>                       {mfa,
>>                           {supervisor,
>>                               start_link,
>>                               [{local,sasl_safe_sup},sasl,safe]}},
>>                       {restart_type,permanent},
>>                       {shutdown,infinity},
>>                       {child_type,supervisor}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_sup}
>>             started: [{pid,<0.47.0>},
>>                       {name,release_handler},
>>                       {mfa,{release_handler,start_link,[]}},
>>                       {restart_type,permanent},
>>                       {shutdown,2000},
>>                       {child_type,worker}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>         application: sasl
>>          started_at: 'session@hannson-test'
>>
>> =SUPERVISOR REPORT==== 31-Oct-2008::12:27:36 ===
>>     Supervisor: {local,session_sup}
>>     Context:    start_error
>>     Reason:     {'EXIT',
>>                     {undef,
>>                         [{thrift_server,
>>                              start_link,
>>                              [8080,sessionServer_thrift,session_service]},
>>                          {supervisor,do_start_child,2},
>>                          {supervisor,start_children,3},
>>                          {supervisor,init_children,2},
>>                          {gen_server,init_it,6},
>>                          {proc_lib,init_p,5}]}}
>>     Offender:   [{pid,undefined},
>>                  {name,session_service},
>>                  {mfa,{session_service,start_link,[]}},
>>                  {restart_type,permanent},
>>                  {shutdown,2000},
>>                  {child_type,worker}]
>>
>> =CRASH REPORT==== 31-Oct-2008::12:27:36 ===
>>  crasher:
>>    pid: <0.51.0>
>>    registered_name: []
>>    error_info: {shutdown,{session_app,start,[normal,[]]}}
>>    initial_call: {application_master,
>>                     init,
>>                     [<0.5.0>,
>>                      <0.50.0>,
>>                      {appl_data,
>>                          session,
>>                          [],
>>                          undefined,
>>                          {session_app,[]},
>>                          ["session_app","session_sup","session_service"],
>>                          [],
>>                          infinity,
>>                          infinity},
>>                      normal]}
>>    ancestors: [<0.50.0>]
>>    messages: [{'EXIT',<0.52.0>,normal}]
>>    links: [<0.50.0>,<0.5.0>]
>>    dictionary: []
>>    trap_exit: true
>>    status: running
>>    heap_size: 610
>>    stack_size: 21
>>    reductions: 2058
>>  neighbours:
>>
>> =INFO REPORT==== 31-Oct-2008::12:27:36 ===
>>    application: session
>>    exited: {shutdown,{session_app,start,[normal,[]]}}
>>    type: temporary
>>
>>
>>
>> On Thu, Oct 30, 2008 at 21:12, Suhail Doshi <digitalwarfare@gmail.com
>> >wrote:
>>
>>
>>
>>> Hannes Baldursson wrote:
>>>
>>>
>>>
>>>> Hi all,
>>>>
>>>> I'm having some troubles with the Erlang generated code from Thrift. I
>>>> might
>>>> add that I'm a newbie in using Thrift and got minimal knowledge about
>>>> Erlang
>>>> but I'm fairly experienced in programming.
>>>>
>>>> I've been looking at the tutorial where in one directory "tutorial/erl/"
>>>> there are files called "server.erl" and "server.sh" that seem to be an
>>>> implementation of the RPC functions. Am I missing something or doesn't
>>>> Thrift generate server stubs based on my definition file?
>>>>
>>>> All the generated files I see are in the gen-erl and I can't see that
>>>> any
>>>> one of them do what server.erl does... am I missing something or do I
>>>> have
>>>> to hand code the "server.erl" file
>>>>
>>>> btw, I will make sure to add your points into the wiki page
>>>>
>>>> Thanks in advance,
>>>> Hannes Baldursson
>>>>
>>>>
>>>>
>>>>
>>>>
>>> Hi Hannes,
>>>
>>> I am very new to thrift too, just started hacking away at it last week.
>>> Fortunately I was lucky to be friends with Todd Lipcon who made the
>>> Erlang
>>> bindings for Thrift in the first place. Something very useful is:
>>>
>>> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>>>
>>> Play around and check it out, should give you a great stepping stone. You
>>> might get stuck make the erlang app, make sure to check where your rpc
>>> directory is pointing to in gen/Makefile.
>>>
>>> Suhail
>>>
>>>
>>>
>>
>>
>>
> Sure, I can pass on the wealth of knowledge:
>
> Download this:
>
> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>
>
> First thing you want to do is execute that perl script so
> do:./make_new_thrift.pl example Example 9090
>
> example - This is name of your thrift file without the extension, a thrift
> file should be in the same directory as the perl script
> Example - Probably the class level name
> 9090 - port feel free to change it
>
> Make sure you've taken the lib/erl/ directory in the thrift source code and
> place it in the same directory as the thrift_skel. Run make on it, we need
> it compiled for this to work.
>
>
> Next make an rpc directory somewhere, I made mine a directory *above* where
> my thrift_skel, thrift directories are. Call it whatever you want, I called
> mine /rpc/. Now you want to edit /example/gen/Makefile. And change the path
> of RPC_DIR to where you actually have it or you will definitely run into
> errors.
>
> Now it's fun time, go into your example/src/ and start editting your
> example_service.erl with any function you want, remember to export it. A
> simple one would be: add(A,B) -> A+B.
> The export at the top of the file below handler_function one would be:
> add/2
>
> Jump back into root directory of your example folder, not the src folder.
> Run make. Everytime you change code, you must run make but you do not have
> to restart your service, Todd made it awesome with code reloading, we'll go
> into that.
>
> Now run: sudo ./start_example.sh and the service should start running with
> a pseudo console for you to reload code and even test your own service.
> Press enter and type: example_service:add(1,3).
>
> Hopefully it works and you see the output of the result.
>
> Sorry if I am babying people in this mailing list, I know some of you could
> code erlang circles around me but it's geared to people who have no idea
> what they are doing. Anyway, enjoy. Don't thank me, thank Todd Lipcon who
> made this and endured a few hours here and there helping me. =)
>
> Sincerely,
> Suhail Doshi
>

Re: Don't get it (Erlang)

Posted by Hannes Baldursson <ha...@gmail.com>.
I just wanted to let you know that I've created two wiki pages,
http://wiki.apache.org/thrift/ThriftUsageErlang and
http://wiki.apache.org/thrift/ThriftUsageErlang

Most of the info comes from my childish questions and the awesome feedback
from  the mailing list!



On Fri, Oct 31, 2008 at 18:10, Suhail Doshi <di...@gmail.com>wrote:

> Hannes Baldursson wrote:
>
>> Whoops I'm still in trouble...
>>
>> I've made great progress though... I've figured out HOW to use the
>> skeleton
>> app generator, I've figured out where to place my definition files and the
>> Erlang lib for thrift. I've managed to make the erlang server app (haven't
>> added any code so far).  I got the server running but it crashed and I
>> wasn't able to connect to it via a PHP client (Connection refused).
>>
>> In short I need a proof of concept server that I can call function foo()
>> and
>> get the string "bar" back to the client.
>>
>> Could you give me a hand?
>>
>> Thanks in advance,
>> Hannes Balduesson
>>
>> Here's a dump of what erlang gives me. What am I doing wrong?
>>
>>
>> Eshell V5.5.5  (abort with ^G)
>> (session@hannson-test)1>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_safe_sup}
>>             started: [{pid,<0.45.0>},
>>                       {name,alarm_handler},
>>                       {mfa,{alarm_handler,start_link,[]}},
>>                       {restart_type,permanent},
>>                       {shutdown,2000},
>>                       {child_type,worker}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_safe_sup}
>>             started: [{pid,<0.46.0>},
>>                       {name,overload},
>>                       {mfa,{overload,start_link,[]}},
>>                       {restart_type,permanent},
>>                       {shutdown,2000},
>>                       {child_type,worker}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_sup}
>>             started: [{pid,<0.44.0>},
>>                       {name,sasl_safe_sup},
>>                       {mfa,
>>                           {supervisor,
>>                               start_link,
>>                               [{local,sasl_safe_sup},sasl,safe]}},
>>                       {restart_type,permanent},
>>                       {shutdown,infinity},
>>                       {child_type,supervisor}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>          supervisor: {local,sasl_sup}
>>             started: [{pid,<0.47.0>},
>>                       {name,release_handler},
>>                       {mfa,{release_handler,start_link,[]}},
>>                       {restart_type,permanent},
>>                       {shutdown,2000},
>>                       {child_type,worker}]
>>
>> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>>         application: sasl
>>          started_at: 'session@hannson-test'
>>
>> =SUPERVISOR REPORT==== 31-Oct-2008::12:27:36 ===
>>     Supervisor: {local,session_sup}
>>     Context:    start_error
>>     Reason:     {'EXIT',
>>                     {undef,
>>                         [{thrift_server,
>>                              start_link,
>>                              [8080,sessionServer_thrift,session_service]},
>>                          {supervisor,do_start_child,2},
>>                          {supervisor,start_children,3},
>>                          {supervisor,init_children,2},
>>                          {gen_server,init_it,6},
>>                          {proc_lib,init_p,5}]}}
>>     Offender:   [{pid,undefined},
>>                  {name,session_service},
>>                  {mfa,{session_service,start_link,[]}},
>>                  {restart_type,permanent},
>>                  {shutdown,2000},
>>                  {child_type,worker}]
>>
>> =CRASH REPORT==== 31-Oct-2008::12:27:36 ===
>>  crasher:
>>    pid: <0.51.0>
>>    registered_name: []
>>    error_info: {shutdown,{session_app,start,[normal,[]]}}
>>    initial_call: {application_master,
>>                     init,
>>                     [<0.5.0>,
>>                      <0.50.0>,
>>                      {appl_data,
>>                          session,
>>                          [],
>>                          undefined,
>>                          {session_app,[]},
>>                          ["session_app","session_sup","session_service"],
>>                          [],
>>                          infinity,
>>                          infinity},
>>                      normal]}
>>    ancestors: [<0.50.0>]
>>    messages: [{'EXIT',<0.52.0>,normal}]
>>    links: [<0.50.0>,<0.5.0>]
>>    dictionary: []
>>    trap_exit: true
>>    status: running
>>    heap_size: 610
>>    stack_size: 21
>>    reductions: 2058
>>  neighbours:
>>
>> =INFO REPORT==== 31-Oct-2008::12:27:36 ===
>>    application: session
>>    exited: {shutdown,{session_app,start,[normal,[]]}}
>>    type: temporary
>>
>>
>>
>> On Thu, Oct 30, 2008 at 21:12, Suhail Doshi <digitalwarfare@gmail.com
>> >wrote:
>>
>>
>>
>>> Hannes Baldursson wrote:
>>>
>>>
>>>
>>>> Hi all,
>>>>
>>>> I'm having some troubles with the Erlang generated code from Thrift. I
>>>> might
>>>> add that I'm a newbie in using Thrift and got minimal knowledge about
>>>> Erlang
>>>> but I'm fairly experienced in programming.
>>>>
>>>> I've been looking at the tutorial where in one directory "tutorial/erl/"
>>>> there are files called "server.erl" and "server.sh" that seem to be an
>>>> implementation of the RPC functions. Am I missing something or doesn't
>>>> Thrift generate server stubs based on my definition file?
>>>>
>>>> All the generated files I see are in the gen-erl and I can't see that
>>>> any
>>>> one of them do what server.erl does... am I missing something or do I
>>>> have
>>>> to hand code the "server.erl" file
>>>>
>>>> btw, I will make sure to add your points into the wiki page
>>>>
>>>> Thanks in advance,
>>>> Hannes Baldursson
>>>>
>>>>
>>>>
>>>>
>>>>
>>> Hi Hannes,
>>>
>>> I am very new to thrift too, just started hacking away at it last week.
>>> Fortunately I was lucky to be friends with Todd Lipcon who made the
>>> Erlang
>>> bindings for Thrift in the first place. Something very useful is:
>>>
>>> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>>>
>>> Play around and check it out, should give you a great stepping stone. You
>>> might get stuck make the erlang app, make sure to check where your rpc
>>> directory is pointing to in gen/Makefile.
>>>
>>> Suhail
>>>
>>>
>>>
>>
>>
>>
> Sure, I can pass on the wealth of knowledge:
>
> Download this:
>
> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>
>
> First thing you want to do is execute that perl script so
> do:./make_new_thrift.pl example Example 9090
>
> example - This is name of your thrift file without the extension, a thrift
> file should be in the same directory as the perl script
> Example - Probably the class level name
> 9090 - port feel free to change it
>
> Make sure you've taken the lib/erl/ directory in the thrift source code and
> place it in the same directory as the thrift_skel. Run make on it, we need
> it compiled for this to work.
>
>
> Next make an rpc directory somewhere, I made mine a directory *above* where
> my thrift_skel, thrift directories are. Call it whatever you want, I called
> mine /rpc/. Now you want to edit /example/gen/Makefile. And change the path
> of RPC_DIR to where you actually have it or you will definitely run into
> errors.
>
> Now it's fun time, go into your example/src/ and start editting your
> example_service.erl with any function you want, remember to export it. A
> simple one would be: add(A,B) -> A+B.
> The export at the top of the file below handler_function one would be:
> add/2
>
> Jump back into root directory of your example folder, not the src folder.
> Run make. Everytime you change code, you must run make but you do not have
> to restart your service, Todd made it awesome with code reloading, we'll go
> into that.
>
> Now run: sudo ./start_example.sh and the service should start running with
> a pseudo console for you to reload code and even test your own service.
> Press enter and type: example_service:add(1,3).
>
> Hopefully it works and you see the output of the result.
>
> Sorry if I am babying people in this mailing list, I know some of you could
> code erlang circles around me but it's geared to people who have no idea
> what they are doing. Anyway, enjoy. Don't thank me, thank Todd Lipcon who
> made this and endured a few hours here and there helping me. =)
>
> Sincerely,
> Suhail Doshi
>

Re: Don't get it (Erlang)

Posted by Suhail Doshi <di...@gmail.com>.
Hannes Baldursson wrote:
> Whoops I'm still in trouble...
>
> I've made great progress though... I've figured out HOW to use the skeleton
> app generator, I've figured out where to place my definition files and the
> Erlang lib for thrift. I've managed to make the erlang server app (haven't
> added any code so far).  I got the server running but it crashed and I
> wasn't able to connect to it via a PHP client (Connection refused).
>
> In short I need a proof of concept server that I can call function foo() and
> get the string "bar" back to the client.
>
> Could you give me a hand?
>
> Thanks in advance,
> Hannes Balduesson
>
> Here's a dump of what erlang gives me. What am I doing wrong?
>
>
> Eshell V5.5.5  (abort with ^G)
> (session@hannson-test)1>
> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>           supervisor: {local,sasl_safe_sup}
>              started: [{pid,<0.45.0>},
>                        {name,alarm_handler},
>                        {mfa,{alarm_handler,start_link,[]}},
>                        {restart_type,permanent},
>                        {shutdown,2000},
>                        {child_type,worker}]
>
> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>           supervisor: {local,sasl_safe_sup}
>              started: [{pid,<0.46.0>},
>                        {name,overload},
>                        {mfa,{overload,start_link,[]}},
>                        {restart_type,permanent},
>                        {shutdown,2000},
>                        {child_type,worker}]
>
> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>           supervisor: {local,sasl_sup}
>              started: [{pid,<0.44.0>},
>                        {name,sasl_safe_sup},
>                        {mfa,
>                            {supervisor,
>                                start_link,
>                                [{local,sasl_safe_sup},sasl,safe]}},
>                        {restart_type,permanent},
>                        {shutdown,infinity},
>                        {child_type,supervisor}]
>
> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>           supervisor: {local,sasl_sup}
>              started: [{pid,<0.47.0>},
>                        {name,release_handler},
>                        {mfa,{release_handler,start_link,[]}},
>                        {restart_type,permanent},
>                        {shutdown,2000},
>                        {child_type,worker}]
>
> =PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
>          application: sasl
>           started_at: 'session@hannson-test'
>
> =SUPERVISOR REPORT==== 31-Oct-2008::12:27:36 ===
>      Supervisor: {local,session_sup}
>      Context:    start_error
>      Reason:     {'EXIT',
>                      {undef,
>                          [{thrift_server,
>                               start_link,
>                               [8080,sessionServer_thrift,session_service]},
>                           {supervisor,do_start_child,2},
>                           {supervisor,start_children,3},
>                           {supervisor,init_children,2},
>                           {gen_server,init_it,6},
>                           {proc_lib,init_p,5}]}}
>      Offender:   [{pid,undefined},
>                   {name,session_service},
>                   {mfa,{session_service,start_link,[]}},
>                   {restart_type,permanent},
>                   {shutdown,2000},
>                   {child_type,worker}]
>
> =CRASH REPORT==== 31-Oct-2008::12:27:36 ===
>   crasher:
>     pid: <0.51.0>
>     registered_name: []
>     error_info: {shutdown,{session_app,start,[normal,[]]}}
>     initial_call: {application_master,
>                      init,
>                      [<0.5.0>,
>                       <0.50.0>,
>                       {appl_data,
>                           session,
>                           [],
>                           undefined,
>                           {session_app,[]},
>                           ["session_app","session_sup","session_service"],
>                           [],
>                           infinity,
>                           infinity},
>                       normal]}
>     ancestors: [<0.50.0>]
>     messages: [{'EXIT',<0.52.0>,normal}]
>     links: [<0.50.0>,<0.5.0>]
>     dictionary: []
>     trap_exit: true
>     status: running
>     heap_size: 610
>     stack_size: 21
>     reductions: 2058
>   neighbours:
>
> =INFO REPORT==== 31-Oct-2008::12:27:36 ===
>     application: session
>     exited: {shutdown,{session_app,start,[normal,[]]}}
>     type: temporary
>
>
>
> On Thu, Oct 30, 2008 at 21:12, Suhail Doshi <di...@gmail.com>wrote:
>
>   
>> Hannes Baldursson wrote:
>>
>>     
>>> Hi all,
>>>
>>> I'm having some troubles with the Erlang generated code from Thrift. I
>>> might
>>> add that I'm a newbie in using Thrift and got minimal knowledge about
>>> Erlang
>>> but I'm fairly experienced in programming.
>>>
>>> I've been looking at the tutorial where in one directory "tutorial/erl/"
>>> there are files called "server.erl" and "server.sh" that seem to be an
>>> implementation of the RPC functions. Am I missing something or doesn't
>>> Thrift generate server stubs based on my definition file?
>>>
>>> All the generated files I see are in the gen-erl and I can't see that any
>>> one of them do what server.erl does... am I missing something or do I have
>>> to hand code the "server.erl" file
>>>
>>> btw, I will make sure to add your points into the wiki page
>>>
>>> Thanks in advance,
>>> Hannes Baldursson
>>>
>>>
>>>
>>>       
>> Hi Hannes,
>>
>> I am very new to thrift too, just started hacking away at it last week.
>> Fortunately I was lucky to be friends with Todd Lipcon who made the Erlang
>> bindings for Thrift in the first place. Something very useful is:
>>
>> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>>
>> Play around and check it out, should give you a great stepping stone. You
>> might get stuck make the erlang app, make sure to check where your rpc
>> directory is pointing to in gen/Makefile.
>>
>> Suhail
>>
>>     
>
>   
Sure, I can pass on the wealth of knowledge:

Download this:

http://github.com/toddlipcon/thrift_erl_skel/tree/master


First thing you want to do is execute that perl script so 
do:./make_new_thrift.pl example Example 9090

example - This is name of your thrift file without the extension, a 
thrift file should be in the same directory as the perl script
Example - Probably the class level name
9090 - port feel free to change it

Make sure you've taken the lib/erl/ directory in the thrift source code 
and place it in the same directory as the thrift_skel. Run make on it, 
we need it compiled for this to work.


Next make an rpc directory somewhere, I made mine a directory *above* 
where my thrift_skel, thrift directories are. Call it whatever you want, 
I called mine /rpc/. Now you want to edit /example/gen/Makefile. And 
change the path of RPC_DIR to where you actually have it or you will 
definitely run into errors.

Now it's fun time, go into your example/src/ and start editting your 
example_service.erl with any function you want, remember to export it. A 
simple one would be: add(A,B) -> A+B.
The export at the top of the file below handler_function one would be: add/2

Jump back into root directory of your example folder, not the src 
folder. Run make. Everytime you change code, you must run make but you 
do not have to restart your service, Todd made it awesome with code 
reloading, we'll go into that.

Now run: sudo ./start_example.sh and the service should start running 
with a pseudo console for you to reload code and even test your own 
service. Press enter and type: example_service:add(1,3).

Hopefully it works and you see the output of the result.

Sorry if I am babying people in this mailing list, I know some of you 
could code erlang circles around me but it's geared to people who have 
no idea what they are doing. Anyway, enjoy. Don't thank me, thank Todd 
Lipcon who made this and endured a few hours here and there helping me. =)

Sincerely,
Suhail Doshi

Re: Don't get it (Erlang)

Posted by Hannes Baldursson <ha...@gmail.com>.
Whoops I'm still in trouble...

I've made great progress though... I've figured out HOW to use the skeleton
app generator, I've figured out where to place my definition files and the
Erlang lib for thrift. I've managed to make the erlang server app (haven't
added any code so far).  I got the server running but it crashed and I
wasn't able to connect to it via a PHP client (Connection refused).

In short I need a proof of concept server that I can call function foo() and
get the string "bar" back to the client.

Could you give me a hand?

Thanks in advance,
Hannes Balduesson

Here's a dump of what erlang gives me. What am I doing wrong?


Eshell V5.5.5  (abort with ^G)
(session@hannson-test)1>
=PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
          supervisor: {local,sasl_safe_sup}
             started: [{pid,<0.45.0>},
                       {name,alarm_handler},
                       {mfa,{alarm_handler,start_link,[]}},
                       {restart_type,permanent},
                       {shutdown,2000},
                       {child_type,worker}]

=PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
          supervisor: {local,sasl_safe_sup}
             started: [{pid,<0.46.0>},
                       {name,overload},
                       {mfa,{overload,start_link,[]}},
                       {restart_type,permanent},
                       {shutdown,2000},
                       {child_type,worker}]

=PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
          supervisor: {local,sasl_sup}
             started: [{pid,<0.44.0>},
                       {name,sasl_safe_sup},
                       {mfa,
                           {supervisor,
                               start_link,
                               [{local,sasl_safe_sup},sasl,safe]}},
                       {restart_type,permanent},
                       {shutdown,infinity},
                       {child_type,supervisor}]

=PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
          supervisor: {local,sasl_sup}
             started: [{pid,<0.47.0>},
                       {name,release_handler},
                       {mfa,{release_handler,start_link,[]}},
                       {restart_type,permanent},
                       {shutdown,2000},
                       {child_type,worker}]

=PROGRESS REPORT==== 31-Oct-2008::12:27:36 ===
         application: sasl
          started_at: 'session@hannson-test'

=SUPERVISOR REPORT==== 31-Oct-2008::12:27:36 ===
     Supervisor: {local,session_sup}
     Context:    start_error
     Reason:     {'EXIT',
                     {undef,
                         [{thrift_server,
                              start_link,
                              [8080,sessionServer_thrift,session_service]},
                          {supervisor,do_start_child,2},
                          {supervisor,start_children,3},
                          {supervisor,init_children,2},
                          {gen_server,init_it,6},
                          {proc_lib,init_p,5}]}}
     Offender:   [{pid,undefined},
                  {name,session_service},
                  {mfa,{session_service,start_link,[]}},
                  {restart_type,permanent},
                  {shutdown,2000},
                  {child_type,worker}]

=CRASH REPORT==== 31-Oct-2008::12:27:36 ===
  crasher:
    pid: <0.51.0>
    registered_name: []
    error_info: {shutdown,{session_app,start,[normal,[]]}}
    initial_call: {application_master,
                     init,
                     [<0.5.0>,
                      <0.50.0>,
                      {appl_data,
                          session,
                          [],
                          undefined,
                          {session_app,[]},
                          ["session_app","session_sup","session_service"],
                          [],
                          infinity,
                          infinity},
                      normal]}
    ancestors: [<0.50.0>]
    messages: [{'EXIT',<0.52.0>,normal}]
    links: [<0.50.0>,<0.5.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 610
    stack_size: 21
    reductions: 2058
  neighbours:

=INFO REPORT==== 31-Oct-2008::12:27:36 ===
    application: session
    exited: {shutdown,{session_app,start,[normal,[]]}}
    type: temporary



On Thu, Oct 30, 2008 at 21:12, Suhail Doshi <di...@gmail.com>wrote:

> Hannes Baldursson wrote:
>
>> Hi all,
>>
>> I'm having some troubles with the Erlang generated code from Thrift. I
>> might
>> add that I'm a newbie in using Thrift and got minimal knowledge about
>> Erlang
>> but I'm fairly experienced in programming.
>>
>> I've been looking at the tutorial where in one directory "tutorial/erl/"
>> there are files called "server.erl" and "server.sh" that seem to be an
>> implementation of the RPC functions. Am I missing something or doesn't
>> Thrift generate server stubs based on my definition file?
>>
>> All the generated files I see are in the gen-erl and I can't see that any
>> one of them do what server.erl does... am I missing something or do I have
>> to hand code the "server.erl" file
>>
>> btw, I will make sure to add your points into the wiki page
>>
>> Thanks in advance,
>> Hannes Baldursson
>>
>>
>>
> Hi Hannes,
>
> I am very new to thrift too, just started hacking away at it last week.
> Fortunately I was lucky to be friends with Todd Lipcon who made the Erlang
> bindings for Thrift in the first place. Something very useful is:
>
> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>
> Play around and check it out, should give you a great stepping stone. You
> might get stuck make the erlang app, make sure to check where your rpc
> directory is pointing to in gen/Makefile.
>
> Suhail
>

Re: Don't get it (Erlang)

Posted by Hannes Baldursson <ha...@gmail.com>.
I will definitely look in to that. Thanks!

On Thu, Oct 30, 2008 at 21:12, Suhail Doshi <di...@gmail.com>wrote:

> Hannes Baldursson wrote:
>
>> Hi all,
>>
>> I'm having some troubles with the Erlang generated code from Thrift. I
>> might
>> add that I'm a newbie in using Thrift and got minimal knowledge about
>> Erlang
>> but I'm fairly experienced in programming.
>>
>> I've been looking at the tutorial where in one directory "tutorial/erl/"
>> there are files called "server.erl" and "server.sh" that seem to be an
>> implementation of the RPC functions. Am I missing something or doesn't
>> Thrift generate server stubs based on my definition file?
>>
>> All the generated files I see are in the gen-erl and I can't see that any
>> one of them do what server.erl does... am I missing something or do I have
>> to hand code the "server.erl" file
>>
>> btw, I will make sure to add your points into the wiki page
>>
>> Thanks in advance,
>> Hannes Baldursson
>>
>>
>>
> Hi Hannes,
>
> I am very new to thrift too, just started hacking away at it last week.
> Fortunately I was lucky to be friends with Todd Lipcon who made the Erlang
> bindings for Thrift in the first place. Something very useful is:
>
> http://github.com/toddlipcon/thrift_erl_skel/tree/master
>
> Play around and check it out, should give you a great stepping stone. You
> might get stuck make the erlang app, make sure to check where your rpc
> directory is pointing to in gen/Makefile.
>
> Suhail
>

Re: Don't get it (Erlang)

Posted by Suhail Doshi <di...@gmail.com>.
Hannes Baldursson wrote:
> Hi all,
>
> I'm having some troubles with the Erlang generated code from Thrift. I might
> add that I'm a newbie in using Thrift and got minimal knowledge about Erlang
> but I'm fairly experienced in programming.
>
> I've been looking at the tutorial where in one directory "tutorial/erl/"
> there are files called "server.erl" and "server.sh" that seem to be an
> implementation of the RPC functions. Am I missing something or doesn't
> Thrift generate server stubs based on my definition file?
>
> All the generated files I see are in the gen-erl and I can't see that any
> one of them do what server.erl does... am I missing something or do I have
> to hand code the "server.erl" file
>
> btw, I will make sure to add your points into the wiki page
>
> Thanks in advance,
> Hannes Baldursson
>
>   
Hi Hannes,

I am very new to thrift too, just started hacking away at it last week. 
Fortunately I was lucky to be friends with Todd Lipcon who made the 
Erlang bindings for Thrift in the first place. Something very useful is:

http://github.com/toddlipcon/thrift_erl_skel/tree/master

Play around and check it out, should give you a great stepping stone. 
You might get stuck make the erlang app, make sure to check where your 
rpc directory is pointing to in gen/Makefile.

Suhail

Re: Don't get it (Erlang)

Posted by Hannes Baldursson <ha...@gmail.com>.
That's pretty much what  I was wondering. I was hoping that I could get a
skeleton app that I'd just fill in the blanks but it works either way I
guess.


On Thu, Oct 30, 2008 at 21:11, Ted Dunning <te...@gmail.com> wrote:

> Hannes,
>
> I can't comment on the Erlang example, but in general with thrift, the
> generated code defines an interface that you have to implement.
>
> When you start the server, you pass your implementation of the
> functionality
> to the server and it handles the RPC (using generated code).  Thus, I would
> think that server.erl implements the server functions as you say while the
> code in gen-erl is the server infrastructure that calls out to server.erl
>
> This design is in contrast to systems that require you to edit the
> generated
> code and has what I think are very clear advantages.
>
> On Thu, Oct 30, 2008 at 2:05 PM, Hannes Baldursson <hannson@gmail.com
> >wrote:
>
> > Hi all,
> >
> > I'm having some troubles with the Erlang generated code from Thrift. I
> > might
> > add that I'm a newbie in using Thrift and got minimal knowledge about
> > Erlang
> > but I'm fairly experienced in programming.
> >
> > I've been looking at the tutorial where in one directory "tutorial/erl/"
> > there are files called "server.erl" and "server.sh" that seem to be an
> > implementation of the RPC functions. Am I missing something or doesn't
> > Thrift generate server stubs based on my definition file?
> >
> > All the generated files I see are in the gen-erl and I can't see that any
> > one of them do what server.erl does... am I missing something or do I
> have
> > to hand code the "server.erl" file
> >
> > btw, I will make sure to add your points into the wiki page
> >
> > Thanks in advance,
> > Hannes Baldursson
> >
>
>
>
> --
> ted
>

Re: Don't get it (Erlang)

Posted by Ted Dunning <te...@gmail.com>.
Hannes,

I can't comment on the Erlang example, but in general with thrift, the
generated code defines an interface that you have to implement.

When you start the server, you pass your implementation of the functionality
to the server and it handles the RPC (using generated code).  Thus, I would
think that server.erl implements the server functions as you say while the
code in gen-erl is the server infrastructure that calls out to server.erl

This design is in contrast to systems that require you to edit the generated
code and has what I think are very clear advantages.

On Thu, Oct 30, 2008 at 2:05 PM, Hannes Baldursson <ha...@gmail.com>wrote:

> Hi all,
>
> I'm having some troubles with the Erlang generated code from Thrift. I
> might
> add that I'm a newbie in using Thrift and got minimal knowledge about
> Erlang
> but I'm fairly experienced in programming.
>
> I've been looking at the tutorial where in one directory "tutorial/erl/"
> there are files called "server.erl" and "server.sh" that seem to be an
> implementation of the RPC functions. Am I missing something or doesn't
> Thrift generate server stubs based on my definition file?
>
> All the generated files I see are in the gen-erl and I can't see that any
> one of them do what server.erl does... am I missing something or do I have
> to hand code the "server.erl" file
>
> btw, I will make sure to add your points into the wiki page
>
> Thanks in advance,
> Hannes Baldursson
>



-- 
ted