Problem with boss_news and boss_db

37 views
Skip to first unread message

Jose Luis Gordo Romero

unread,
Feb 9, 2012, 2:38:05 PM2/9/12
to chica...@googlegroups.com
Hi,

I'm having problems with boss_news, I declared in the init the following:

init() ->
    {ok, Acty} = boss_news:watch("modelxs",
        fun (created, X) ->
            {ok, ActyC} = activities:add(X)
        end),
    {ok, [Acty]}.

activities:add(X) only adds a new record to a different model.

When a record is inserted in modelx, the run_after_hooks timeouts:

** exception exit: {timeout,{gen_server,call,
                                        [{global,boss_news},
                                         {created,"modelx-43",
                                                  [{id,"modelx-43"},
                                                   .....
                                                   {created_time,{1328,815623,280614}},
                                                   {updated_time,{1328,815623,280614}}]}]}}
     in function  gen_server:call/2 (gen_server.erl, line 180)
     in call from boss_record_lib:run_after_hooks/3 (src/boss/boss_record_lib.erl, line 11)
     in call from boss_db:save_record/1 (src/boss/boss_db.erl, line 195)

Only happens when creates a new boss_db record inside the boss_new:wath/2 fun, I'm in a multiapp setup (but started-dev from the app containing the init watches) and working with one node (dev).

The funny thing is that the new record is created, but the timeout+restart makes this ugly. 

Any thoughts?

Thanks!

--
Jose Luis Gordo Romero

Evan Miller

unread,
Feb 9, 2012, 3:22:15 PM2/9/12
to chica...@googlegroups.com
I think the problem is that the boss_news process is executing the callback, but the callback then sends a message to boss_news => deadlock. This is a design flaw. We need worker processes to execute the callbacks instead

Sent from my iPhone

Jose Luis Gordo Romero

unread,
Feb 10, 2012, 2:21:41 AM2/10/12
to chica...@googlegroups.com
Thanks Evan,

A good moment to start using https://github.com/devinus/poolboy ?


--
Jose Luis Gordo Romero



2012/2/9 Evan Miller <emmi...@gmail.com>

douglas

unread,
Feb 10, 2012, 6:43:44 AM2/10/12
to chica...@googlegroups.com
In the spirit of ChicagoBoss , why not call the ORM dempster_diver

Evan Miller

unread,
Feb 10, 2012, 12:19:01 PM2/10/12
to chica...@googlegroups.com
On Fri, Feb 10, 2012 at 1:21 AM, Jose Luis Gordo Romero
<jgo...@gmail.com> wrote:
> Thanks Evan,
>
> A good moment to start using https://github.com/devinus/poolboy ?
>

Not necessarily. We might want an unlimited number of workers created
on-demand rather than a fixed pool size.

I'll try to look into fixing the process model of all of CB's services
this weekend.

Evan

--
Evan Miller
http://www.evanmiller.org/

Jose Luis Gordo Romero

unread,
Feb 10, 2012, 1:33:08 PM2/10/12
to chica...@googlegroups.com
This sounds amazing!


--
Jose Luis Gordo Romero



2012/2/10 Evan Miller <emmi...@gmail.com>

douglas

unread,
Feb 10, 2012, 1:48:44 PM2/10/12
to chica...@googlegroups.com

mongos

For sharded environments, each mongos process can perform any number of operations concurrently. This results in downstream operations to mongod instances. Execution of operations at each mongod is independent; that is, one mongod does not block another.


Evan Miller

unread,
Feb 10, 2012, 10:26:14 PM2/10/12
to chica...@googlegroups.com
Try this

https://github.com/evanmiller/boss_db/commit/8076dda5a23bb4e174e6226087b90fe8ceee2c2b

There are also some UNTESTED poolboy commits in there, but I think the
above patch will solve the BossNews deadlock you encountered.

Jose Luis Gordo Romero

unread,
Feb 11, 2012, 3:30:05 AM2/11/12
to chica...@googlegroups.com
Hi,

I'm not tested all the app, but I can confirm that the commit solves the deadlock.

Terrific!


--
Jose Luis Gordo Romero



2012/2/11 Evan Miller <emmi...@gmail.com>
Reply all
Reply to author
Forward
0 new messages