couchdb icon indicating copy to clipboard operation
couchdb copied to clipboard

CouchDB 2.1.0 fails to start under macOS High Sierra

Open dj-at-work opened this issue 9 years ago • 17 comments

After updating from macOS Sierra (10.12.6) to High Sierra (10.13) CouchDb 2.1.0 fails to start.

I had a running CouchDB 2.1.0 on Sierra (10.12.6) with multiple databases. During the install process the running couchdb was stoped by macOS. After the update to High Sierra CouchDB showed the behavior as described below.

I replaced the current installation by a fresh one: I removed the Apache CouchDB app from programs and deleted the CouchDB2 folder from the /Users/username/Library/Application Support. Downloaded the app again and installed it to programs.

Running a fresh installation makes unfortunately no difference.

Current Behavior

After starting the Apache CouchDB app couchdb keeps restarting and opening browser windows with the admin console URL.

The log (debug level) looks like this:

[info] 2017-09-26T09:42:12.253683Z couchdb@localhost <0.202.0> -------- Starting couch_sup
[debug] 2017-09-26T09:42:12.253820Z couchdb@localhost <0.202.0> -------- Supervisor couch_sup started config_listener_mon:start_link(couch_sup, nil) at pid <0.203.0>
[debug] 2017-09-26T09:42:12.630034Z couchdb@localhost <0.204.0> -------- Supervisor couch_primary_services started couch_drv:start_link() at pid <0.205.0>
[debug] 2017-09-26T09:42:12.638250Z couchdb@localhost <0.204.0> -------- Supervisor couch_primary_services started couch_task_status:start_link() at pid <0.206.0>
[debug] 2017-09-26T09:42:12.663819Z couchdb@localhost <0.204.0> -------- Supervisor couch_primary_services started couch_server:sup_start_link() at pid <0.207.0>
[debug] 2017-09-26T09:42:12.663903Z couchdb@localhost <0.202.0> -------- Supervisor couch_sup started couch_primary_sup:start_link() at pid <0.204.0>
[debug] 2017-09-26T09:42:12.676391Z couchdb@localhost <0.210.0> -------- Supervisor couch_secondary_services started gen_event:start_link({local,couch_plugin}) at pid <0.211.0>
[debug] 2017-09-26T09:42:12.685797Z couchdb@localhost <0.210.0> -------- Supervisor couch_secondary_services started couch_proc_manager:start_link() at pid <0.212.0>
[debug] 2017-09-26T09:42:12.706931Z couchdb@localhost <0.210.0> -------- Supervisor couch_secondary_services started couch_httpd_vhost:start_link() at pid <0.214.0>
[debug] 2017-09-26T09:42:33.254900Z couchdb@localhost <0.111.0> -------- Supervisor couch_log_sup started couch_log_monitor:start_link() at pid <0.114.0>
[debug] 2017-09-26T09:42:33.268683Z couchdb@localhost <0.111.0> -------- Supervisor couch_log_sup started config_listener_mon:start_link(couch_log_sup, nil) at pid <0.115.0>
[info] 2017-09-26T09:42:33.268713Z couchdb@localhost <0.7.0> -------- Application couch_log started on node couchdb@localhost
[debug] 2017-09-26T09:42:33.274106Z couchdb@localhost <0.119.0> -------- Supervisor folsom_sup started folsom_sample_slide_sup:start_link() at pid <0.120.0>
[debug] 2017-09-26T09:42:33.279882Z couchdb@localhost <0.119.0> -------- Supervisor folsom_sup started folsom_meter_timer_server:start_link() at pid <0.121.0>
[debug] 2017-09-26T09:42:33.285270Z couchdb@localhost <0.119.0> -------- Supervisor folsom_sup started folsom_metrics_histogram_ets:start_link() at pid <0.122.0>
[info] 2017-09-26T09:42:33.285389Z couchdb@localhost <0.7.0> -------- Application folsom started on node couchdb@localhost
[debug] 2017-09-26T09:42:33.426693Z couchdb@localhost <0.126.0> -------- Supervisor couch_stats_sup started couch_stats_aggregator:start_link() at pid <0.127.0>
[debug] 2017-09-26T09:42:33.432456Z couchdb@localhost <0.126.0> -------- Supervisor couch_stats_sup started couch_stats_process_tracker:start_link() at pid <0.176.0>
[info] 2017-09-26T09:42:33.432569Z couchdb@localhost <0.7.0> -------- Application couch_stats started on node couchdb@localhost
[info] 2017-09-26T09:42:33.432679Z couchdb@localhost <0.7.0> -------- Application khash started on node couchdb@localhost
[debug] 2017-09-26T09:42:33.464524Z couchdb@localhost <0.181.0> -------- Supervisor couch_event_sup2 started couch_event_server:start_link() at pid <0.182.0>
[debug] 2017-09-26T09:42:33.470571Z couchdb@localhost <0.184.0> -------- Supervisor couch_event_os_sup started config_listener_mon:start_link(couch_event_os_sup, nil) at pid <0.185.0>
[debug] 2017-09-26T09:42:33.470705Z couchdb@localhost <0.181.0> -------- Supervisor couch_event_sup2 started couch_event_os_sup:start_link() at pid <0.184.0>
[info] 2017-09-26T09:42:33.470820Z couchdb@localhost <0.7.0> -------- Application couch_event started on node couchdb@localhost
[debug] 2017-09-26T09:42:33.492272Z couchdb@localhost <0.189.0> -------- Supervisor ibrowse_sup started ibrowse:start_link() at pid <0.190.0>
[info] 2017-09-26T09:42:33.492386Z couchdb@localhost <0.7.0> -------- Application ibrowse started on node couchdb@localhost
[debug] 2017-09-26T09:42:33.510824Z couchdb@localhost <0.195.0> -------- Supervisor ioq_sup started ioq:start_link() at pid <0.196.0>
[info] 2017-09-26T09:42:33.510938Z couchdb@localhost <0.7.0> -------- Application ioq started on node couchdb@localhost
[info] 2017-09-26T09:42:33.511045Z couchdb@localhost <0.7.0> -------- Application mochiweb started on node couchdb@localhost
[info] 2017-09-26T09:42:33.538921Z couchdb@localhost <0.201.0> -------- Apache CouchDB 2.1.0 is starting.

Steps to Reproduce (for bugs)

  1. fresh download of Apache CouchDB app for mac
  2. Double click on Apache CouchDB app in Programs

Environment

  • Version used: 2.1.0
  • Operating System and version (desktop or mobile): macOS 10.13 (High Sierra)

dj-at-work avatar Sep 26 '17 10:09 dj-at-work

That looks like CouchDB is running fine, but the contributed application that @janl wrote has some sort of error.

Are you able to curl localhost:5984 in a terminal window and get the proper response at least?

wohali avatar Sep 26 '17 16:09 wohali

I'm having the same ussue, curl returns the following:

➜ ~ curl http://127.0.0.1:5984 curl: (7) Failed to connect to 127.0.0.1 port 5984: Connection refused

In addition, i have the same environment that OP: OS: Mac OS High Sierra 10.13 (17A365) (App Store Release) CouchDB: 2.1.0

hugazo avatar Sep 26 '17 18:09 hugazo

@wohali The couch is definitely not running. Curl returned with curl: (7) Failed to connect to localhost port 5984: Connection refused.

I've played a bit around. I've extracted couchdbx-corefolder from the CouchDB 2.1.0 app and run it in the terminal. I get Segmentation fault: 11 as final result:

./bin/couchdb 
[info] 2017-09-27T09:44:14.776619Z couchdb@localhost <0.7.0> -------- Application couch_log started on node couchdb@localhost
[info] 2017-09-27T09:44:14.796307Z couchdb@localhost <0.7.0> -------- Application folsom started on node couchdb@localhost
[info] 2017-09-27T09:44:14.953660Z couchdb@localhost <0.7.0> -------- Application couch_stats started on node couchdb@localhost
[info] 2017-09-27T09:44:14.953816Z couchdb@localhost <0.7.0> -------- Application khash started on node couchdb@localhost
[info] 2017-09-27T09:44:15.016863Z couchdb@localhost <0.7.0> -------- Application couch_event started on node couchdb@localhost
[info] 2017-09-27T09:44:15.036828Z couchdb@localhost <0.7.0> -------- Application ibrowse started on node couchdb@localhost
[info] 2017-09-27T09:44:15.055847Z couchdb@localhost <0.7.0> -------- Application ioq started on node couchdb@localhost
[info] 2017-09-27T09:44:15.055999Z couchdb@localhost <0.7.0> -------- Application mochiweb started on node couchdb@localhost
[info] 2017-09-27T09:44:15.086719Z couchdb@localhost <0.201.0> -------- Apache CouchDB 2.1.0 is starting.

[info] 2017-09-27T09:44:15.086864Z couchdb@localhost <0.202.0> -------- Starting couch_sup
Segmentation fault: 11

The same (?) result, when I start CouchDB 1.6.1. The application reports an error and offer to quit or retry. The couchdb.log contains:

Launching '/Applications/Apache CouchDB.app/Contents/Resources/couchdbx-core/bin/couchdb'
Eshell V6.1  (abort with ^G)
Apache CouchDB 1.6.1 (LogLevel=info) is starting.
Terminated with status 11

dj-at-work avatar Sep 27 '17 10:09 dj-at-work

I’ll look at this over the weekend.

janl avatar Sep 27 '17 16:09 janl

This is an Erlang bug:

https://bugs.erlang.org/browse/ERL-439

This commit fixed the problem:

https://github.com/erlang/otp/commit/882c90f72ba4e298aa5a7796661c28053c540a96

If you can build Erlang from source, try applying this change and you should be good to go. CouchDB isn't ready yet for Erlang 20, so you'll need a build of Erlang 19.x or older that includes this one-line change for High Sierra builds to work correctly.

wohali avatar Sep 28 '17 23:09 wohali

Thanks everyone for raising this and your patience with us resolving the issue.

Can you all please download this and report back? Thanks!

  • zip: https://dist.apache.org/repos/dist/release/couchdb/binary/mac/2.1.0/Apache-CouchDB-2.1.0-1.zip
  • sha256: https://dist.apache.org/repos/dist/release/couchdb/binary/mac/2.1.0/Apache-CouchDB-2.1.0-1.zip.s256
  • sha512: https://dist.apache.org/repos/dist/release/couchdb/binary/mac/2.1.0/Apache-CouchDB-2.1.0-1.zip.s512
  • gig signature: https://dist.apache.org/repos/dist/release/couchdb/binary/mac/2.1.0/Apache-CouchDB-2.1.0-1.zip.asc

janl avatar Sep 30 '17 17:09 janl

Hi @janl, thank you! I did a quick test and it looks fine so far. I will do more tests in the next days.

dj-at-work avatar Sep 30 '17 18:09 dj-at-work

I just tested as well. The new binary fixes the issue for me. Thanks @janl

Chris-Andrews avatar Sep 30 '17 18:09 Chris-Andrews

@TheNightbear @Chris-Andrews Thanks! New zip up on the site: https://github.com/apache/couchdb-www/commit/b7a7235e6ee125b5f5fb998e64783016b3adc987

janl avatar Sep 30 '17 19:09 janl

Just a quick follow-up, everything working OK.

Thanks!

hugazo avatar Oct 01 '17 00:10 hugazo

It works, thanks

contrerasmarc avatar Oct 09 '17 10:10 contrerasmarc

I installed CouchDB 2.1 on High Sierra three days ago. At first, It seemed to work, but from time to time I'm getting the following error, which never happened before on Mac OS 10.12 Sierra. CouchDB keeps restarting and restarting. UPDATE: also, it's telling my "type error" when I try to log in.

`CRASH REPORT Process couch_compaction_daemon (<0.6896.0>) with 0 neighbors exited with reason: {compaction_loop_died,{{badmatch,{error,enoent}},[{couch_compaction_daemon,abs_path,1,[{file,"src/couch_compaction_daemon.erl"},{line,526}]},{couch_compaction_daemon,free_space_rec,2,[{file,"src/couch_compaction_daemon.erl"},{line,517}]},{couch_compaction_daemon,can_db_compact,2,[{file,"src/couch_compaction_daemon.erl"},{line,327}]},{couch_compaction_daemon,maybe_compact_db,3,[{file,"src/couch_compaction_daemon.erl"},{line,164}]},{couch_compaction_daemon,'-compact_loop/1-fun-0-',3,[{file,"s..."},...]},...]}} at gen_server:terminate/7(line:812) <= proc_lib:init_p_do_apply/3(line:247); initial_call: {couch_compaction_daemon,init,['Argument__1']}, ancestors: [couch_secondary_services,couch_sup,<0.207.0>], messages: [], links: [<0.6511.0>], dictionary: [], trap_exit: true, status: running, heap_size: 987, stack_size: 27, reductions: 2788 [error] 2017-10-22T10:36:20.844313Z couchdb@localhost <0.6511.0> -------- Supervisor couch_secondary_services had child compaction_daemon started with couch_compaction_daemon:start_link() at <0.6896.0> exit with reason {compaction_loop_died,{{badmatch,{error,enoent}},[{couch_compaction_daemon,abs_path,1,[{file,"src/couch_compaction_daemon.erl"},{line,526}]},{couch_compaction_daemon,free_space_rec,2,[{file,"src/couch_compaction_daemon.erl"},{line,517}]},{couch_compaction_daemon,can_db_compact,2,[{file,"src/couch_compaction_daemon.erl"},{line,327}]},{couch_compaction_daemon,maybe_compact_db,3,[{file,"src/couch_compaction_daemon.erl"},{line,164}]},{couch_compaction_daemon,'-compact_loop/1-fun-0-',3,[{file,"s..."},...]},...]}} in context child_terminated

update: has nothing to do with the "autocompaction whitespace bug"

kinesias avatar Oct 22 '17 10:10 kinesias

@kinesias Actually, yes, it is related. That's the exact error we'd expect in that situation. Any mounted volume that has a space in it will cause this crash.

You can disable the compaction daemon to fix this for now:

https://github.com/apache/couchdb/issues/802#issuecomment-332590111

wohali avatar Oct 24 '17 17:10 wohali

oh, interesting, because I renamed all my mounted volumes -- first it seemed to work, but then it crashed again... I appreciate your help very much, you guys are awesome!

kinesias avatar Oct 24 '17 17:10 kinesias

I am having CouchDB 2.1.1 for mac and having same issue. When I start couchDB then it start opening new tab with address http://127.0.0.1:5984/_utils/ and refused to connect. It continue to open until I force quit it. I tried to do according to your reply but Didn't find local.ini file. Please let me know the path of this file for mac Please find crash log file CouchDB2.log

navneet21sharma avatar May 12 '18 16:05 navneet21sharma

Upon upgrading to MacOS High Sierra, CouchDB fails to start. For legacy reasons I need to to run v1.6.0 (we use a deprecated river to sync with ElasticSearch). Following @wohali 's suggestion, I patched and rebuilt Erlang, then modified couchdbx-core/bin/erl to point to the new binaries. However, I still get the exact same error as before:

Segmentation fault: 11

Could it be I also need to rebuild CouchDB's Erlang libs using that patch?

Edit:

I think my issue was that in bin/erl I was modifying BINDIR but not ROOTDIR. I installed R16B01 using kerl, and now Couch is running happily.

diachedelic avatar Sep 10 '18 06:09 diachedelic

I am having CouchDB 2.1.1 for mac and having same issue. When I start couchDB then it start opening new tab with address http://127.0.0.1:5984/_utils/ and refused to connect. It continue to open until I force quit it. I tried to do according to your reply but Didn't find local.ini file. Please let me know the path of this file for mac Please find crash log file CouchDB2.log

Hello, did you find any solution? @navneet21sharma

EmreKorpe avatar Sep 29 '23 11:09 EmreKorpe