couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jan Lehnardt (JIRA)" <j...@apache.org>
Subject [jira] Closed: (COUCHDB-354) Ungraceful behaviour if view returns a function
Date Fri, 22 May 2009 13:34:45 GMT

     [ https://issues.apache.org/jira/browse/COUCHDB-354?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Jan Lehnardt closed COUCHDB-354.
--------------------------------

    Resolution: Fixed

no barfs in trunk.

--


> ruby1.9 test_reduce_barf.rb 

reduce across all says:
{"rows":[]}
jan@dahlia ~/Downloads 
> curl http://127.0.0.1:5984/
{"couchdb":"Welcome","version":"0.10.0a773842"}

--

Apache CouchDB 0.10.0a773842 (LogLevel=debug) is starting.
Configuration Settings ["/Users/jan/Work/couchdb/trunk/etc/couchdb/default_dev.ini",
                        "/Users/jan/Work/couchdb/trunk/etc/couchdb/local_dev.ini"]:
  [couchdb] batch_save_interval="1000"
  [couchdb] batch_save_size="1000"
  [couchdb] database_dir="/Users/jan/Work/couchdb/trunk/tmp/lib"
  [couchdb] max_attachment_chunk_size="4294967296"
  [couchdb] max_dbs_open="100"
  [couchdb] max_document_size="4294967296"
  [couchdb] os_process_timeout="5000"
  [couchdb] util_driver_dir="/Users/jan/Work/couchdb/trunk/src/couchdb/.libs"
  [couchdb] view_index_dir="/Users/jan/Work/couchdb/trunk/tmp/lib"
  [daemons] batch_save="{couch_batch_save_sup, start_link, []}"
  [daemons] db_update_notifier="{couch_db_update_notifier_sup, start_link, []}"
  [daemons] external_manager="{couch_external_manager, start_link, []}"
  [daemons] httpd="{couch_httpd, start_link, []}"
  [daemons] query_servers="{couch_query_servers, start_link, []}"
  [daemons] stats_aggregator="{couch_stats_aggregator, start, []}"
  [daemons] stats_collector="{couch_stats_collector, start, []}"
  [daemons] view_manager="{couch_view, start_link, []}"
  [httpd] WWW-Authenticate="Basic realm=\"administrator\""
  [httpd] authentication_handler="{couch_httpd, default_authentication_handler}"
  [httpd] bind_address="127.0.0.1"
  [httpd] default_handler="{couch_httpd_db, handle_request}"
  [httpd] port="5984"
  [httpd_db_handlers] _changes="{couch_httpd_db, handle_changes_req}"
  [httpd_db_handlers] _compact="{couch_httpd_db, handle_compact_req}"
  [httpd_db_handlers] _design="{couch_httpd_db, handle_design_req}"
  [httpd_db_handlers] _temp_view="{couch_httpd_view, handle_temp_view_req}"
  [httpd_design_handlers] _list="{couch_httpd_show, handle_view_list_req}"
  [httpd_design_handlers] _show="{couch_httpd_show, handle_doc_show_req}"
  [httpd_design_handlers] _view="{couch_httpd_view, handle_view_req}"
  [httpd_global_handlers] /="{couch_httpd_misc_handlers, handle_welcome_req, <<\"Welcome\">>}"
  [httpd_global_handlers] _active_tasks="{couch_httpd_misc_handlers, handle_task_status_req}"
  [httpd_global_handlers] _all_dbs="{couch_httpd_misc_handlers, handle_all_dbs_req}"
  [httpd_global_handlers] _config="{couch_httpd_misc_handlers, handle_config_req}"
  [httpd_global_handlers] _log="{couch_httpd_misc_handlers, handle_log_req}"
  [httpd_global_handlers] _replicate="{couch_httpd_misc_handlers, handle_replicate_req}"
  [httpd_global_handlers] _restart="{couch_httpd_misc_handlers, handle_restart_req}"
  [httpd_global_handlers] _sleep="{couch_httpd_misc_handlers, handle_sleep_req}"
  [httpd_global_handlers] _stats="{couch_httpd_stats_handlers, handle_stats_req}"
  [httpd_global_handlers] _utils="{couch_httpd_misc_handlers, handle_utils_dir_req, \"/Users/jan/Work/couchdb/trunk/share/www\"}"
  [httpd_global_handlers] _uuids="{couch_httpd_misc_handlers, handle_uuids_req}"
  [httpd_global_handlers] favicon.ico="{couch_httpd_misc_handlers, handle_favicon_req, \"/Users/jan/Work/couchdb/trunk/share/www\"}"
  [log] file="/Users/jan/Work/couchdb/trunk/tmp/log/couch.log"
  [log] level="debug"
  [query_server_config] reduce_limit="true"
  [query_servers] javascript="/Users/jan/Work/couchdb/trunk/bin/couchjs_dev /Users/jan/Work/couchdb/trunk/share/server/main.js"
Apache CouchDB has started. Time to relax.
[info] [<0.1.0>] Apache CouchDB has started.
[debug] [<0.52.0>] 'DELETE' /test {1,1}
Headers: [{'Accept',"application/xml"},
          {'Accept-Encoding',"gzip, deflate"},
          {'Host',"127.0.0.1:5984"},
          {'User-Agent',"Ruby"}]
[debug] [<0.52.0>] httpd 404 error response:
 {"error":"not_found","reason":"missing"}

[info] [<0.52.0>] 127.0.0.1 - - 'DELETE' /test 404
[debug] [<0.57.0>] 'PUT' /test {1,1}
Headers: [{'Accept',"application/xml"},
          {'Accept-Encoding',"gzip, deflate"},
          {'Content-Length',"2"},
          {'Content-Type',"application/x-www-form-urlencoded"},
          {'Host',"127.0.0.1:5984"},
          {'User-Agent',"Ruby"}]
[info] [<0.57.0>] 127.0.0.1 - - 'PUT' /test 201
[debug] [<0.58.0>] 'POST' /test/_bulk_docs {1,1}
Headers: [{'Accept',"application/xml"},
          {'Accept-Encoding',"gzip, deflate"},
          {'Content-Length',"1901"},
          {'Content-Type',"application/x-www-form-urlencoded"},
          {'Host',"127.0.0.1:5984"},
          {'User-Agent',"Ruby"}]
[info] [<0.58.0>] 127.0.0.1 - - 'POST' /test/_bulk_docs 201
[debug] [<0.67.0>] 'PUT' /test/_design/test {1,1}
Headers: [{'Accept',"application/xml"},
          {'Accept-Encoding',"gzip, deflate"},
          {'Content-Length',"896"},
          {'Content-Type',"application/x-www-form-urlencoded"},
          {'Host',"127.0.0.1:5984"},
          {'User-Agent',"Ruby"}]
[info] [<0.67.0>] 127.0.0.1 - - 'PUT' /test/_design/test 201
[debug] [<0.68.0>] 'GET' /test/_design/test/_view/test {1,1}
Headers: [{'Accept',"application/xml"},
          {'Accept-Encoding',"gzip, deflate"},
          {'Host',"127.0.0.1:5984"},
          {'User-Agent',"Ruby"}]
[debug] [<0.44.0>] Spawning new group server for view group _design/test in database
test.
[debug] [<0.70.0>] Reseting group index "_design/test" in db test
[debug] [<0.68.0>] request_group {Pid, Seq} {<0.70.0>,151}
[debug] [<0.68.0>] request_group {Pid, Seq} {<0.70.0>,151}
[info] [<0.68.0>] 127.0.0.1 - - 'GET' /test/_design/test/_view/test 200
[debug] [<0.69.0>] 'GET' / {1,1}
Headers: [{'Accept',"*/*"},
          {'Host',"127.0.0.1:5984"},
          {'User-Agent',"curl/7.16.3 (powerpc-apple-darwin9.0) libcurl/7.16.3 OpenSSL/0.9.7l
zlib/1.2.3"}]
[info] [<0.69.0>] 127.0.0.1 - - 'GET' / 200


> Ungraceful behaviour if view returns a function
> -----------------------------------------------
>
>                 Key: COUCHDB-354
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-354
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: JavaScript View Server
>         Environment: {"couchdb":"Welcome","version":"0.10.0a776990"}
>            Reporter: Brian Candler
>            Priority: Minor
>         Attachments: barf.log, test_reduce_barf.rb
>
>
> If a typo in a view definition causes it to return a function instead of a normal value:
> * the view server crashes
> * you get a huge Erlang barf in the log with worrying messages like "OS process timed
out" and "brutal kill"
> I got all this just by accidentally writing "vs.shift" instead of "vs.shift()"
> The fundamental problem is that a function cannot be serialised in toJSON, but the error
message is not helpful:
> OS Process Log Message: Error converting object to JSON: TypeError: {Array:function (v)
{var ... snip loads ... "Object"] is not a function
> When actually the problem is that the object I was trying to convert *was* a function
:-)
> I will attach some code which replicates this, and the barf generated.
> Of course this is entirely down to user error in an invalid map/reduce function. However
there's already a clean error for 'undefined', maybe this could be done for 'function' too
(or indeed any non-serialisable entity)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message