Unable to begin transaction: no daemon connection

Hi All,

Hopefully, you will be able to help me with this problem what I have.

I read all the comments what I have found on these pages from other users, but no one helps me.

I have a docker image with a long-running CLI PHP process based on alpine. PHP is 7.2.7. I tried to install a couple of latest NR clients but no one helps me.

  1. If I have the default configuration daemon do not want to start at all (from the log, but I can see processes, what is strange), so with the default configuration I have following:
    2019-10-17 13:10:54.721 +0000 (126 126) info: New Relic 9.1.0.246 (“heliotrope” - “c095b8eafcd9”) [daemon=’/tmp/.newrelic.sock’ php=‘7.2.7’ zts=no sapi=‘cli’ pid=126 ppid=88 uid=0 euid=0 gid=0 egid=0 backtrace=no startup=agent os=‘Linux’ rel=‘4.15.0-1034-aws’ mach=‘x86_64’ ver=’#36-Ubuntu SMP Tue Mar 5 23’ node=‘5d61c6760960’]
    2019-10-17 13:10:54.721 +0000 (126 126) info: spawned daemon child pid=127
    2019-10-17 13:10:54.778 +0000 (126 126) debug: MINIT processing done
    2019-10-17 13:10:54.779 +0000 (126 126) debug: late_init called from pid=126
    2019-10-17 13:10:54.779 +0000 (126 126) warning: daemon connect(fd=5 uds=/tmp/.newrelic.sock) returned -1 errno=ECONNREFUSED. Failed to connect to the newrelic-daemon. Please makesure that there is a properly configured newrelic-daemon running. For additional assistance, please see: https://newrelic.com/docs/php/newrelic-daemon-startup-modes
    2019-10-17 13:10:54.779 +0000 (126 126) debug: unable to begin transaction: no daemon connection

  2. If I switch port to the ‘@newrelic.daemon’ I have the following:
    2019-10-17 13:13:41.741 +0000 (103 103) info: New Relic 9.1.0.246 (“heliotrope” - “c095b8eafcd9”) [daemon=’@newrelic-daemon’ php=‘7.2.7’ zts=no sapi=‘cli’ pid=103 ppid=89 uid=0 euid=0 gid=0 egid=0 backtrace=no startup=agent os=‘Linux’ rel=‘4.15.0-1034-aws’ mach=‘x86_64’ ver=’#36-Ubuntu SMP Tue Mar 5 23’ node=‘5d61c6760960’]
    2019-10-17 13:13:41.741 +0000 (103 103) info: spawned daemon child pid=104
    2019-10-17 13:13:41.765 +0000 (103 103) debug: MINIT processing done
    2019-10-17 13:13:41.766 +0000 (103 103) debug: late_init called from pid=103
    2019-10-17 13:13:41.766 +0000 (103 103) warning: daemon connect(fd=5 uds=@newrelic-daemon) returned -1 errno=ECONNREFUSED. Failed to connect to the newrelic-daemon. Please make sure that there is a properly configured newrelic-daemon running. For additional assistance, please see: https://newrelic.com/docs/php/newrelic-daemon-startup-modes
    2019-10-17 13:13:41.766 +0000 (103 103) debug: unable to begin transaction: no daemon connection

  3. If I switch port to 3013, for example, I have the following:
    2019-10-17 13:15:27.425 +0000 (394 394) info: New Relic 9.1.0.246 (“heliotrope” - “c095b8eafcd9”) [daemon=3013 php=‘7.2.7’ zts=no sapi=‘cli’ pid=394 ppid=384 uid=0 euid=0 gid=0 egid=0 backtrace=no startup=agent os=‘Linux’ rel=‘4.15.0-1034-aws’ mach=‘x86_64’ ver=’#36-Ubuntu SMP Tue Mar 5 23’ node=‘5d61c6760960’]
    2019-10-17 13:15:27.436 +0000 (394 394) info: spawned daemon child pid=395
    2019-10-17 13:15:27.464 +0000 (394 394) debug: MINIT processing done
    2019-10-17 13:15:27.464 +0000 (394 394) debug: late_init called from pid=394
    2019-10-17 13:15:27.465 +0000 (394 394) debug: unable to begin transaction: no daemon connection

I tried to add more specific configurations in the newrelic.ini file like:
newrelic.transaction_tracer.enabled = false
newrelic.transtaction_tracer.slow_sql = false
but does not help at all.

And I get in the php_agent.log messages like:
2019-10-17 13:15:33.604 +0000 (61 61) info: New Relic 9.1.0.246 (“heliotrope” - “c095b8eafcd9”) [daemon=3013 php=‘7.2.7’ zts=no sapi=‘cli’ pid=61 ppid=8 uid=0 euid=0 gid=0 egid=0 backtrace=no startup=agent os=‘Linux’ rel=‘4.15.0-1034-aws’ mach=‘x86_64’ ver=’#36-Ubuntu SMP Tue Mar 5 23’ node=‘5d61c6760960’]
2019-10-17 13:15:33.699 +0000 (61 61) debug: MINIT processing done
2019-10-17 13:15:33.700 +0000 (61 61) debug: late_init called from pid=61
2019-10-17 13:15:33.700 +0000 (61 61) debug: added app=‘my-service’ license=‘09…7e’
2019-10-17 13:15:33.702 +0000 (61 61) debug: APPINFO reply unknown app=‘my-service’
2019-10-17 13:15:33.702 +0000 (61 61) debug: unable to begin transaction: app ‘my-service’ is unknown

It sounds like you have a single long running PHP script which is getting lost because your app hasn’t fully connected when the script starts. You might find my guide here helpful:

1 Like