{"action":"opened","issue":{"url":"https://api.github.com/repos/zalando/patroni/issues/697","repository_url":"https://api.github.com/repos/zalando/patroni","labels_url":"https://api.github.com/repos/zalando/patroni/issues/697/labels{/name}","comments_url":"https://api.github.com/repos/zalando/patroni/issues/697/comments","events_url":"https://api.github.com/repos/zalando/patroni/issues/697/events","html_url":"https://github.com/zalando/patroni/issues/697","id":329994818,"node_id":"MDU6SXNzdWUzMjk5OTQ4MTg=","number":697,"title":"Could not load library \".../libpqwalreceiver.so\"","user":{"login":"superflav","id":597749,"node_id":"MDQ6VXNlcjU5Nzc0OQ==","avatar_url":"https://avatars0.githubusercontent.com/u/597749?v=4","gravatar_id":"","url":"https://api.github.com/users/superflav","html_url":"https://github.com/superflav","followers_url":"https://api.github.com/users/superflav/followers","following_url":"https://api.github.com/users/superflav/following{/other_user}","gists_url":"https://api.github.com/users/superflav/gists{/gist_id}","starred_url":"https://api.github.com/users/superflav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/superflav/subscriptions","organizations_url":"https://api.github.com/users/superflav/orgs","repos_url":"https://api.github.com/users/superflav/repos","events_url":"https://api.github.com/users/superflav/events{/privacy}","received_events_url":"https://api.github.com/users/superflav/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-06T19:07:32Z","updated_at":"2018-06-06T19:07:32Z","closed_at":null,"author_association":"NONE","body":"We compile and install Postgres in a non-standard location (/opt/custom/share/postgresql-9.6.2_7 in the example below) which requires that we specify the `LD_LIBRARY_PATH` env var when starting up postgres and when working with postgres utilities. When starting up Postgres, Patroni currently passes along `PATH`, `LC_ALL` and `LANG` env vars if they are set, but does not do the same with `LD_LIBRARY_PATH`. This results in the following FATAL replication error on the replica node:\r\n```\r\n2018-06-05 21:10:26,675 INFO: Lock owner: postgresdb-01; I am postgresdb-02\r\n2018-06-05 21:10:26,675 INFO: does not have lock\r\n2018-06-05 21:10:26,676 INFO: no action.  i am a secondary and i am following a leader\r\nFATAL:  could not load library \"/opt/custom/share/postgresql-9.6.2_7/lib/libpqwalreceiver.so\": libpq.so.5: cannot open shared object file: No such file or directory\r\nFATAL:  could not load library \"/opt/custom/share/postgresql-9.6.2_7/lib/libpqwalreceiver.so\": libpq.so.5: cannot open shared object file: No such file or directory\r\n```\r\n\r\nThe fix for this is to pass `LD_LIBRARY_PATH` along with the other env vars, which results in replication behaving as expected:\r\n```\r\n2018-06-05 22:03:08,722 INFO: Lock owner: postgresdb-01; I am postgresdb-02\r\n2018-06-05 22:03:08,722 INFO: does not have lock\r\n2018-06-05 22:03:08,727 DEBUG: Sending request(xid=49): SetData(path='/service/postgres_cluster/members/postgresdb-02', data='{\"conn_url\":\"postgres://postgresdb-02:5432/postgres\",\"api_url\":\"http://postgresdb-02:8008/patroni\",\"timeline\":1,\"state\":\"running\",\"role\":\"replica\",\"xlog_location\":184664496}', version=-1)\r\n2018-06-05 22:03:08,737 DEBUG: Received response(xid=49): ZnodeStat(czxid=4294967413, mzxid=4294967497, ctime=1528235848173, mtime=1528236188727, version=28, cversion=0, aversion=0, ephemeralOwner=216194533074731009, dataLength=169, numChildren=0, pzxid=4294967413)\r\n2018-06-05 22:03:08,741 INFO: no action.  i am a secondary and i am following a leader\r\n```\r\n\r\nI will submit a pull request shortly that addresses this problem."}}
{"actor":{"display_login":"superflav"}}