Kibana.bat error - events.js:174 throw er;

running kibana.bat errors out leaving the followin message:

 log   [02:42:44.536] [info][optimize] Optimizing and caching bundles for core, graph, monitoring, space_selector, ml, dashboardViewer, apm, maps, canvas, infra, siem, uptime, lens, searchguard-login, searchguard-customerror, searchguard-configuration, searchguard-multitenancy, searchguard-accountinfo, searchguard-signals, kibana, stateSessionStorageRedirect, status_page and timelion. This may take a few minutes
events.js:174
      throw er; // Unhandled 'error' event
      ^

what did I try:

  1. Removed data directory from D:\elk\kibana-7.6.1-windows-x86_64\kibana-7.6.1-windows-x86_64
    to
    D:\elk\data
  2. Specified path to data directory in kibana.yml as follows:
    path.data: D:\elk\data

My kibana.yml

elasticsearch.hosts: "https://localhost:9200"

# Configure the Kibana internal server user
elasticsearch.username: "kibanaserver"
elasticsearch.password: "kibanaserver"

# Disable SSL verification when using self-signed demo certificates elasticsearch.ssl.verificationMode: none
elasticsearch.requestHeadersWhitelist: ["Authorization", "sgtenant"]
searchguard.auth.type: "openid"
searchguard.openid.connect_url: "http://localhost:8180/auth/realms/master/.well-known/openid-configuration"
searchguard.openid.client_id: "kibana-sso"
searchguard.openid.client_secret: "d2bc2d8e-27f2-4636-8ab0-caf43bd3801d"
path.data: "D:\elk\data"

The error is being thrown only after I made searcguard-related entries in the kibana.yml

Someone pleasse help!

Thanks in advance

Does “D:\elk\data” exist on your machine?

Try to clear Kibana cache:

cd kibana
rm -rf optimize/bundles/*

Then restart Kibana.

If you still have the error, let’s try to narrow down the scope of possible errors and set a basic configuration first. Put only the following lines into kibana.yml

elasticsearch.hosts: ["https://localhost:9200"]
elasticsearch.username: "kibanaserver"
elasticsearch.password: "kibanaserver"
elasticsearch.ssl.verificationMode: none
elasticsearch.requestHeadersWhitelist: [ "authorization", "sgtenant" ]
searchguard.multitenancy.enabled: false
searchguard.accountinfo.enabled: true
xpack.security.enabled: false

Let me know.

Thanks so much @srgbnd for the valuable response.

I did try clearing kibana cache. It did not help.
I ended up re-installing elasticsearch and kibana in a different drive. Started all over again from scratch.
Now, as you mentioned, I’ve only the basic configuration set in kibana.yml (shown below)

My kibana.yml

elasticsearch.hosts: "https://localhost:9200"
# Configure the Kibana internal server user
elasticsearch.username: "kibanaserver"
elasticsearch.password: "kibanaserver"
# Disable SSL verification because we use self-signed demo certificates
elasticsearch.ssl.verificationMode: none
# Whitelist the Search Guard Multi Tenancy Header
elasticsearch.requestHeadersWhitelist: [ "Authorization", "sgtenant" ]
xpack.security.enabled: false

When I start kibana.bat I get the following error:

  log   [22:11:05.514] [info][optimize] Optimizing and caching bundles for core, graph, monitoring, space_selector, ml, dashboardViewer, apm, maps, canvas, infra, siem, uptime, lens, searchguard-login, searchguard-customerror, searchguard-configuration, searchguard-multitenancy, searchguard-accountinfo, searchguard-signals, kibana, stateSessionStorageRedirect, status_page and timelion. This may take a few minutes
<--- Last few GCs --->
[16196:0000024741D462B0]   205848 ms: Mark-sweep 1329.0 (1440.4) -> 1313.5 (1437.4) MB, 931.3 / 0.0 ms  (average mu = 0.363, current mu = 0.369) allocation failure scavenge might not succeed
[16196:0000024741D462B0]   206944 ms: Mark-sweep 1322.5 (1437.4) -> 1313.9 (1435.4) MB, 1004.8 / 0.0 ms  (average mu = 0.238, current mu = 0.083) allocation failure GC in old space requested
<--- JS stacktrace --->
==== JS stack trace =========================================
    0: ExitFrame [pc: 00000082FC15C5C1]
Security context: 0x0263af19e6e9 <JSObject>
    1: /* anonymous */(aka /* anonymous */) [000001F3149E0E91] [C:\elk\kibana-7.6.1-windows-x86_64\kibana-7.6.1-windows-x86_64\node_modules\terser\dist\bundle.min.js:~1] [pc=00000082FD16CBB3](this=0x0091eb2826f1 <undefined>,e=0x0046dfc6dad9 <AST_Call map = 0000001417ED8159>,t=0x01eab859eb11 <Object map = 000003B8F16FD1F9>)
    2: /* anonymous */(aka /* ano...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF75BBE832A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+4506
 2: 00007FF75BBC2DB6 node::MakeCallback+4534
 3: 00007FF75BBC3730 node_module_register+2032
 4: 00007FF75BEDC14E v8::internal::FatalProcessOutOfMemory+846
 5: 00007FF75BEDC07F v8::internal::FatalProcessOutOfMemory+639
 6: 00007FF75C0C2874 v8::internal::Heap::MaxHeapGrowingFactor+9620
 7: 00007FF75C0B9856 v8::internal::ScavengeJob::operator=+24550
 8: 00007FF75C0B7EAC v8::internal::ScavengeJob::operator=+17980
 9: 00007FF75C0C0BF7 v8::internal::Heap::MaxHeapGrowingFactor+2327
10: 00007FF75C0C0C76 v8::internal::Heap::MaxHeapGrowingFactor+2454
11: 00007FF75C1EAF17 v8::internal::Factory::NewFillerObject+55
12: 00007FF75C268106 v8::internal::operator<<+73494
13: 00000082FC15C5C1

In order to fix this error, I set the following NODE_OPTION before starting kibana.bat
set NODE_OPTIONS= “–max-old-space-size=8192 %NODE_OPTIONS%”

After I set the NODE_OPTIONS, I get the following error:

  log   [22:43:04.023] [info][optimize] Optimizing and caching bundles for core, graph, monitoring, space_selector, ml, dashboardViewer, apm, maps, canvas, infra, siem, uptime, lens, searchguard-login, searchguard-customerror, searchguard-configuration, searchguard-multitenancy, searchguard-accountinfo, searchguard-signals, kibana, stateSessionStorageRedirect, timelion and status_page. This may take a few minutes
events.js:174
      throw er; // Unhandled 'error' event
      ^
Error: write EPIPE
    at afterWriteDispatched (internal/stream_base_commons.js:78:25)
    at writeGeneric (internal/stream_base_commons.js:73:3)
    at Socket._writeGeneric (net.js:714:5)
    at Socket._write (net.js:726:8)
    at doWrite (_stream_writable.js:415:12)
    at clearBuffer (_stream_writable.js:545:7)
    at onwrite (_stream_writable.js:470:7)
    at WriteWrap.afterWrite (net.js:801:19)
Emitted 'error' event at:
    at errorOrDestroy (internal/streams/destroy.js:107:12)
    at onwriteError (_stream_writable.js:430:5)
    at onwrite (_stream_writable.js:461:5)
    at _destroy (internal/streams/destroy.js:49:7)
    at Socket._destroy (net.js:614:3)
    at Socket.destroy (internal/streams/destroy.js:37:8)
    at afterWriteDispatched (internal/stream_base_commons.js:78:17)
    at writeGeneric (internal/stream_base_commons.js:73:3)
    [... lines matching original stack trace ...]
    at WriteWrap.afterWrite (net.js:801:19)

can you help me fix these errors?

Thanks in advance

Try to set --max-old-space-size option in kibana.bat to make sure it is not ignored somehow. You can take the code below and substitute all the code you have in kibana/bin/kibana.bat with it.

@echo off

SETLOCAL

set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI

set NODE=%DIR%\node\node.exe

set NODE_ENV="production"

If Not Exist "%NODE%" (
 Echo unable to find usable node.js executable.
 Exit /B 1
)

set "NODE_OPTIONS=--no-warnings --max-http-header-size=65536 --max-old-space-size=8192 %NODE_OPTIONS%" && "%NODE%" "%DIR%\src\cli" %*

:finally

ENDLOCAL

Also, monitor your RAM during Kibana start. Do you have enough RAM?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.