You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by Jacinto de Guzmán <x....@gmail.com> on 2008/12/27 02:39:31 UTC

Problem with update notification

Hi everyone,

Using a checkout of HEAD from the trunk, I am noticing a problem with update
notifications. To demonstrate, I created a simple Python program:


#! /usr/bin/env python

import sys
import logging as log

log.basicConfig(level=log.INFO, filename='/tmp/updates.log')


if __name__ == '__main__':
    try:
        args = sys.argv[1:]
        log.info("Started with args: %r" % args)
        line = sys.stdin.readline()
        while line:
            log.info("Notification: %s" % line)
    except Exception:
        log.excepton("Exception")


In my local.ini I have:


[update_notification]
test_notification = /tmp/test_notification.py


I start CouchDB and then save a document, and I get the following in
/tmp/updates.log (log file created by test_notification.py):


INFO:root:Started with args: []
INFO:root:Started with args: []


CouchDB logs the following trace:


[Tue, 25 Dec 2008 01:53:55 GMT] [error] [<0.54.0>] ** gen_event handler
{couch_db_update_notifier,#Ref<0.0.0.154>} crashed.
** Was installed in couch_db_update
** Last event was: {updated,<<"test">>}
** When handler state == {ok,<0.60.0>}
** Reason == {{badfun,ok},
              [{couch_db_update_notifier,handle_event,2},
               {gen_event,server_update,4},
               {gen_event,server_notify,4},
               {gen_event,handle_msg,5},
               {proc_lib,init_p,5}]}


[Tue, 25 Dec 2008 01:53:55 GMT] [error] [<0.59.0>] ** Generic server
<0.59.0> terminating 
** Last message in was {gen_event_EXIT,
                           {couch_db_update_notifier,#Ref<0.0.0.154>},
                           {'EXIT',
                               {{badfun,ok},
                                [{couch_db_update_notifier,handle_event,2},
                                 {gen_event,server_update,4},
                                 {gen_event,server_notify,4},
                                 {gen_event,handle_msg,5},
                                 {proc_lib,init_p,5}]}}}
** When Server state == {couch_db_update,
                            {couch_db_update_notifier,#Ref<0.0.0.154>}}
** Reason for termination == 
** {'EXIT',{{badfun,ok},
            [{couch_db_update_notifier,handle_event,2},
             {gen_event,server_update,4},
             {gen_event,server_notify,4},
             {gen_event,handle_msg,5},
             {proc_lib,init_p,5}]}}


[Tue, 25 Dec 2008 01:53:55 GMT] [error] [<0.59.0>] {error_report,<0.22.0>,
    {<0.59.0>,crash_report,
     [[{pid,<0.59.0>},
       {registered_name,[]},
       {error_info,
           {exit,
               {'EXIT',
                   {{badfun,ok},
                    [{couch_db_update_notifier,handle_event,2},
                     {gen_event,server_update,4},
                     {gen_event,server_notify,4},
                     {gen_event,handle_msg,5},
                     {proc_lib,init_p,5}]}},
               [{gen_server,terminate,6},{proc_lib,init_p,5}]}},
       {initial_call,
           {gen,init_it,
               [gen_server,<0.58.0>,<0.58.0>,couch_event_sup,
                {couch_db_update,
                    {couch_db_update_notifier,#Ref<0.0.0.154>},
                    "/tmp/test_notification.py"},
                []]}},
       {ancestors,
           [couch_db_update_notifier_sup,couch_secondary_services,
            couch_server_sup,<0.1.0>]},
       {messages,[]},
       {links,[<0.58.0>,<0.54.0>]},
       {dictionary,[]},
       {trap_exit,false},
       {status,running},
       {heap_size,377},
       {stack_size,23},
       {reductions,151}],
      []]}}

[Tue, 25 Dec 2008 01:53:55 GMT] [error] [<0.54.0>] ** gen_event handler
{couch_db_update_notifier,#Ref<0.0.0.150>} crashed.
** Was installed in couch_db_update
** Last event was: {'EXIT',<0.59.0>,
                           {'EXIT',{{badfun,ok},
                                   
[{couch_db_update_notifier,handle_event,2},
                                     {gen_event,server_update,4},
                                     {gen_event,server_notify,4},
                                     {gen_event,handle_msg,5},
                                     {proc_lib,init_p,5}]}}}
** When handler state == #Fun<couch_view.6.133160776>
** Reason == {function_clause,
                 [{couch_db_update_notifier,handle_info,
                      [{'EXIT',<0.59.0>,
                           {'EXIT',
                               {{badfun,ok},
                                [{couch_db_update_notifier,handle_event,2},
                                 {gen_event,server_update,4},
                                 {gen_event,server_notify,4},
                                 {gen_event,handle_msg,5},
                                 {proc_lib,init_p,5}]}}},
                       #Fun<couch_view.6.133160776>]},
                  {gen_event,server_update,4},
                  {gen_event,server_notify,4},
                  {gen_event,handle_exit,4},
                  {gen_event,handle_msg,5},
                  {proc_lib,init_p,5}]}


[Tue, 25 Dec 2008 01:53:55 GMT] [error] [<0.58.0>] {error_report,<0.22.0>,
    {<0.58.0>,supervisor_report,
     [{supervisor,{local,couch_db_update_notifier_sup}},
      {errorContext,child_terminated},
      {reason,
          {'EXIT',
              {{badfun,ok},
               [{couch_db_update_notifier,handle_event,2},
                {gen_event,server_update,4},
                {gen_event,server_notify,4},
                {gen_event,handle_msg,5},
                {proc_lib,init_p,5}]}}},
      {offender,
          [{pid,<0.59.0>},
           {name,"test_notification"},
           {mfa,
               {couch_db_update_notifier,start_link,
                   ["/tmp/test_notification.py"]}},
           {restart_type,permanent},
           {shutdown,1000},
           {child_type,supervisor}]}]}}

[Tue, 25 Dec 2008 01:53:55 GMT] [error] [<0.57.0>] ** Generic server
<0.57.0> terminating 
** Last message in was {gen_event_EXIT,
                        {couch_db_update_notifier,#Ref<0.0.0.150>},
                        {'EXIT',
                         {function_clause,
                          [{couch_db_update_notifier,handle_info,
                            [{'EXIT',<0.59.0>,
                              {'EXIT',
                               {{badfun,ok},
                                [{couch_db_update_notifier,handle_event,2},
                                 {gen_event,server_update,4},
                                 {gen_event,server_notify,4},
                                 {gen_event,handle_msg,5},
                                 {proc_lib,init_p,5}]}}},
                             #Fun<couch_view.6.133160776>]},
                           {gen_event,server_update,4},
                           {gen_event,server_notify,4},
                           {gen_event,handle_exit,4},
                           {gen_event,handle_msg,5},
                           {proc_lib,init_p,5}]}}}
** When Server state == {couch_db_update,
                            {couch_db_update_notifier,#Ref<0.0.0.150>}}
** Reason for termination == 
** {'EXIT',
       {function_clause,
           [{couch_db_update_notifier,handle_info,
                [{'EXIT',<0.59.0>,
                     {'EXIT',
                         {{badfun,ok},
                          [{couch_db_update_notifier,handle_event,2},
                           {gen_event,server_update,4},
                           {gen_event,server_notify,4},
                           {gen_event,handle_msg,5},
                           {proc_lib,init_p,5}]}}},
                 #Fun<couch_view.6.133160776>]},
            {gen_event,server_update,4},
            {gen_event,server_notify,4},
            {gen_event,handle_exit,4},
            {gen_event,handle_msg,5},
            {proc_lib,init_p,5}]}}


[Tue, 25 Dec 2008 01:53:55 GMT] [error] [<0.57.0>] {error_report,<0.22.0>,
 {<0.57.0>,crash_report,
  [[{pid,<0.57.0>},
    {registered_name,[]},
    {error_info,
     {exit,
      {'EXIT',
       {function_clause,
        [{couch_db_update_notifier,handle_info,
          [{'EXIT',<0.59.0>,
            {'EXIT',
             {{badfun,ok},
              [{couch_db_update_notifier,handle_event,2},
               {gen_event,server_update,4},
               {gen_event,server_notify,4},
               {gen_event,handle_msg,5},
               {proc_lib,init_p,5}]}}},
           #Fun<couch_view.6.133160776>]},
         {gen_event,server_update,4},
         {gen_event,server_notify,4},
         {gen_event,handle_exit,4},
         {gen_event,handle_msg,5},
         {proc_lib,init_p,5}]}},
      [{gen_server,terminate,6},{proc_lib,init_p,5}]}},
    {initial_call,
     {gen,init_it,
      [gen_server,<0.56.0>,<0.56.0>,couch_event_sup,
       {couch_db_update,
        {couch_db_update_notifier,#Ref<0.0.0.150>},
        #Fun<couch_view.6.133160776>},
       []]}},
    {ancestors,
     [couch_view,couch_secondary_services,couch_server_sup,
      <0.1.0>]},
    {messages,[]},
    {links,[<0.56.0>,<0.54.0>]},
    {dictionary,[]},
    {trap_exit,false},
    {status,running},
    {heap_size,377},
    {stack_size,23},
    {reductions,160}],
   []]}}

[Tue, 25 Dec 2008 01:53:55 GMT] [error] [<0.56.0>] Exit on non-updater
process: {'EXIT',
                              {function_clause,
                               [{couch_db_update_notifier,handle_info,
                                 [{'EXIT',<0.59.0>,
                                   {'EXIT',
                                    {{badfun,ok},
                                    
[{couch_db_update_notifier,handle_event,
                                       2},
                                      {gen_event,server_update,4},
                                      {gen_event,server_notify,4},
                                      {gen_event,handle_msg,5},
                                      {proc_lib,init_p,5}]}}},
                                  #Fun<couch_view.6.133160776>]},
                                {gen_event,server_update,4},
                                {gen_event,server_notify,4},
                                {gen_event,handle_exit,4},
                                {gen_event,handle_msg,5},
                                {proc_lib,init_p,5}]}}

[Tue, 25 Dec 2008 01:53:55 GMT] [error] [<0.56.0>] ** Generic server
couch_view terminating 
** Last message in was {'EXIT',<0.57.0>,
                        {'EXIT',
                         {function_clause,
                          [{couch_db_update_notifier,handle_info,
                            [{'EXIT',<0.59.0>,
                              {'EXIT',
                               {{badfun,ok},
                                [{couch_db_update_notifier,handle_event,2},
                                 {gen_event,server_update,4},
                                 {gen_event,server_notify,4},
                                 {gen_event,handle_msg,5},
                                 {proc_lib,init_p,5}]}}},
                             #Fun<couch_view.6.133160776>]},
                           {gen_event,server_update,4},
                           {gen_event,server_notify,4},
                           {gen_event,handle_exit,4},
                           {gen_event,handle_msg,5},
                           {proc_lib,init_p,5}]}}}
** When Server state == {server,"/usr/local/couchdb/var/lib/couchdb",
                                undefined,100,0,[]}
** Reason for termination == 
** {'EXIT',
       {function_clause,
           [{couch_db_update_notifier,handle_info,
                [{'EXIT',<0.59.0>,
                     {'EXIT',
                         {{badfun,ok},
                          [{couch_db_update_notifier,handle_event,2},
                           {gen_event,server_update,4},
                           {gen_event,server_notify,4},
                           {gen_event,handle_msg,5},
                           {proc_lib,init_p,5}]}}},
                 #Fun<couch_view.6.133160776>]},
            {gen_event,server_update,4},
            {gen_event,server_notify,4},
            {gen_event,handle_exit,4},
            {gen_event,handle_msg,5},
            {proc_lib,init_p,5}]}}


[Tue, 25 Dec 2008 01:53:55 GMT] [error] [<0.56.0>] {error_report,<0.22.0>,
 {<0.56.0>,crash_report,
  [[{pid,<0.56.0>},
    {registered_name,couch_view},
    {error_info,
     {exit,
      {'EXIT',
       {function_clause,
        [{couch_db_update_notifier,handle_info,
          [{'EXIT',<0.59.0>,
            {'EXIT',
             {{badfun,ok},
              [{couch_db_update_notifier,handle_event,2},
               {gen_event,server_update,4},
               {gen_event,server_notify,4},
               {gen_event,handle_msg,5},
               {proc_lib,init_p,5}]}}},
           #Fun<couch_view.6.133160776>]},
         {gen_event,server_update,4},
         {gen_event,server_notify,4},
         {gen_event,handle_exit,4},
         {gen_event,handle_msg,5},
         {proc_lib,init_p,5}]}},
      [{gen_server,terminate,6},{proc_lib,init_p,5}]}},
    {initial_call,
     {gen,init_it,
      [gen_server,<0.55.0>,<0.55.0>,
       {local,couch_view},
       couch_view,[],[]]}},
    {ancestors,
     [couch_secondary_services,couch_server_sup,<0.1.0>]},
    {messages,[]},
    {links,[<0.55.0>]},
    {dictionary,[]},
    {trap_exit,true},
    {status,running},
    {heap_size,377},
    {stack_size,23},
    {reductions,262}],
   []]}}

[Tue, 25 Dec 2008 01:53:55 GMT] [error] [<0.55.0>] {error_report,<0.22.0>,
    {<0.55.0>,supervisor_report,
     [{supervisor,{local,couch_secondary_services}},
      {errorContext,child_terminated},
      {reason,
          {'EXIT',
              {function_clause,
                  [{couch_db_update_notifier,handle_info,
                       [{'EXIT',<0.59.0>,
                            {'EXIT',
                                {{badfun,ok},
                                 [{couch_db_update_notifier,handle_event,2},
                                  {gen_event,server_update,4},
                                  {gen_event,server_notify,4},
                                  {gen_event,handle_msg,5},
                                  {proc_lib,init_p,5}]}}},
                        #Fun<couch_view.6.133160776>]},
                   {gen_event,server_update,4},
                   {gen_event,server_notify,4},
                   {gen_event,handle_exit,4},
                   {gen_event,handle_msg,5},
                   {proc_lib,init_p,5}]}}},
      {offender,
          [{pid,<0.56.0>},
           {name,view_manager},
           {mfa,{couch_view,start_link,[]}},
           {restart_type,permanent},
           {shutdown,brutal_kill},
           {child_type,worker}]}]}}


I appreciate any help.


-----
Jacinto Ximénez de Guzmán

-- 
View this message in context: http://n2.nabble.com/Problem-with-update-notification-tp1961907p1961907.html
Sent from the CouchDB Development mailing list archive at Nabble.com.