question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Healthcheck should return error if ES is unreachable

See original GitHub issue

Environment

Host

item version
OS cos-beta-79-12607-32-0
GROWI 3.6.2
node.js 12.14.0
npm 6.13.4
Using Docker yes (k8s)
Using growi-docker-compose no

(Accessing https://{GROWI_HOST}/admin helps you to fill in above versions)

Client

item version
OS N/A
browser N/A

How to reproduce? (再現手順)

  1. Deploy MongoDB
  2. Do NOT deploy Elasticsearch
  3. Deploy GROWI (with MONGO_URI and ELASTICSEARCH_URI set)

What happens? (症状)

  • /_api/v3/healthcheck?connectToMiddlewares returns 200 OK.
$ kubectl logs -f v2-wiki-growi-6587f799b6-72f5b
yarn run v1.21.1
$ npm run migrate
npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1578640629571-0.40919678355467703/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> growi@3.6.2 migrate /opt/growi
> npm run migrate:up

npm WARN lifecycle The node binary used for scripts is /tmp/yarn--1578640629571-0.40919678355467703/node but npm is using /usr/local/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> growi@3.6.2 migrate:up /opt/growi
> migrate-mongo up -f config/migrate.js

(node:53) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated, and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
$ env-cmd -f config/env.prod.js node src/server/app.js
express-validator: requires to express-validator/check are deprecated.You should just use require("express-validator") instead.
(node:71) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.
[2020-01-10T07:17:12.166Z]  INFO: growi:service:search/71 on v2-wiki-growi-6587f799b6-72f5b: Initializing search delegator
[2020-01-10T07:17:12.167Z]  INFO: growi:service:search/71 on v2-wiki-growi-6587f799b6-72f5b: Elasticsearch (not Searchbox) is enabled
[2020-01-10T07:17:12.716Z]  INFO: growi:plugins:PluginService/71 on v2-wiki-growi-6587f799b6-72f5b: load plugin 'growi-plugin-attachment-refs'
[2020-01-10T07:17:12.718Z]  INFO: growi:plugins:PluginService/71 on v2-wiki-growi-6587f799b6-72f5b: load plugin 'growi-plugin-lsx'
[2020-01-10T07:17:12.720Z]  INFO: growi:plugins:PluginService/71 on v2-wiki-growi-6587f799b6-72f5b: load plugin 'growi-plugin-pukiwiki-like-linker'
express-validator: requires to express-validator/filter are deprecated.You should just use require("express-validator") instead.
[2020-01-10T07:17:12.925Z]  INFO: growi:crowi/71 on v2-wiki-growi-6587f799b6-72f5b: [production] Express server is listening on port 3000
Elasticsearch ERROR: 2020-01-10T07:17:12Z
  Error: Request error, retrying
  GET http://elasticsearch-master:9200/_nodes => getaddrinfo ENOTFOUND elasticsearch-master
      at Log.error (/opt/growi/node_modules/elasticsearch/src/lib/log.js:226:56)
      at checkRespForFailure (/opt/growi/node_modules/elasticsearch/src/lib/transport.js:266:18)
      at HttpConnector.<anonymous> (/opt/growi/node_modules/elasticsearch/src/lib/connectors/http.js:164:7)
      at ClientRequest.wrapper (/opt/growi/node_modules/elasticsearch/node_modules/lodash/lodash.js:4949:19)
      at ClientRequest.emit (events.js:210:5)
      at Socket.socketErrorListener (_http_client.js:406:9)
      at Socket.emit (events.js:210:5)
      at emitErrorNT (internal/streams/destroy.js:92:8)
      at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
      at processTicksAndRejections (internal/process/task_queues.js:80:21)

Elasticsearch WARNING: 2020-01-10T07:17:12Z
  Unable to revive connection: http://elasticsearch-master:9200/

Elasticsearch WARNING: 2020-01-10T07:17:12Z
  No living connections

[2020-01-10T07:17:12.942Z] ERROR: growi:service:search-delegator:elasticsearch/71 on v2-wiki-growi-6587f799b6-72f5b:
  Couldn't check ES version: NoConnections [Error]: No Living connections
      at sendReqWithConnection (/opt/growi/node_modules/elasticsearch/src/lib/transport.js:233:15)
      at next (/opt/growi/node_modules/elasticsearch/src/lib/connection_pool.js:214:7)
      at processTicksAndRejections (internal/process/task_queues.js:75:11) {
    message: 'No Living connections',
    body: undefined,
    status: undefined
  }
Elasticsearch WARNING: 2020-01-10T07:17:12Z
  Unable to revive connection: http://elasticsearch-master:9200/

Elasticsearch WARNING: 2020-01-10T07:17:12Z
  No living connections

[2020-01-10T07:17:12.958Z] ERROR: growi/71 on v2-wiki-growi-6587f799b6-72f5b:
  Unhandled Rejection: Promise: Promise {
    <rejected> NoConnections [Error]: No Living connections
        at sendReqWithConnection (/opt/growi/node_modules/elasticsearch/src/lib/transport.js:233:15)
        at next (/opt/growi/node_modules/elasticsearch/src/lib/connection_pool.js:214:7)
        at processTicksAndRejections (internal/process/task_queues.js:75:11) {
      message: 'No Living connections',
      body: false,
      status: undefined
    }
  } Reason: NoConnections [Error]: No Living connections
      at sendReqWithConnection (/opt/growi/node_modules/elasticsearch/src/lib/transport.js:233:15)
      at next (/opt/growi/node_modules/elasticsearch/src/lib/connection_pool.js:214:7)
      at processTicksAndRejections (internal/process/task_queues.js:75:11) {
    message: 'No Living connections',
    body: false,
    status: undefined
  }
[2020-01-10T07:17:26.872Z]  INFO: express/71 on v2-wiki-growi-6587f799b6-72f5b: ::ffff:10.12.1.1 <-- GET /_api/v3/healthcheck/?connectToMiddlewares HTTP/1.1 200 68 - Other 0.0 Other 0.0.0 22.217453 ms (req_id=42586f3b-4d4b-40e7-b63e-b98132f0331a)
(node:71) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
[2020-01-10T07:17:28.429Z]  INFO: express/71 on v2-wiki-growi-6587f799b6-72f5b: ::ffff:10.12.1.1 <-- GET /_api/v3/healthcheck/ HTTP/1.1 200 15 - Other 0.0 Other 0.0.0 1.382779 ms (req_id=b8b99036-0e9e-4f3d-a82f-9ee5ad7c8347)

What is the expected result? (期待される動作)

  • Readiness check return non-200 response code.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
yuki-takeicommented, Feb 3, 2020
0reactions
yuki-takeicommented, Jan 27, 2020

#1565 is merged. Please wait for v3.6.5 release.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot failing health checks for Application Load ... - AWS
Verify that your application responds to the load balancer's health check requests accordingly. The following example shows a typical health ...
Read more >
2.1.6 Spring Boot - Elasticsearch Healthcheck failure
It seems that you're not using the right configuration namespace in your application.yml file; spring.data.elasticsearch.host does not exist.
Read more >
Health Checks with Spring Boot - Reflectoring
In this class, we return the status as UP if the URL is reachable, otherwise, we return the DOWN status with an error...
Read more >
A guide to API health check - Testfully
**But to reap all that goodness, you need to monitor your API health ... API health check endpoint returns the operational status of...
Read more >
Spring Boot Actuator: Health check, Auditing, Metrics ...
The status will be UP as long as the application is healthy. It will show DOWN if the application gets unhealthy due to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found