# Error in logstash.agent - Bad file descriptor (Errno::EBADF)

**URL:** <https://discuss.elastic.co/t/error-in-logstash-agent-bad-file-descriptor-errno-ebadf/108961>\
**Category:** Logstash\
**Created:** [November 24, 2017, 4:31am UTC](https://discuss.elastic.co/t/error-in-logstash-agent-bad-file-descriptor-errno-ebadf/108961 "2017-11-24T04:31:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![arbabu89](https://avatars.discourse-cdn.com/v4/letter/a/278dde/32.png) [@arbabu89](https://discuss.elastic.co/u/arbabu89)\
**Post date:** [November 24, 2017, 4:31am UTC](https://discuss.elastic.co/t/error-in-logstash-agent-bad-file-descriptor-errno-ebadf/108961/1 "2017-11-24T04:31:00Z")

</div>

Hi I am trying to load data from MS SQL server to Elastic search using logstash and got error in logstash agent

this is my logstash config file -

input {  
jdbc {  
jdbc\_driver\_library =\> "C:\local\lib\sqljdbc42.jar"  
jdbc\_driver\_class =\> "com.microsoft.jdbc.sqlserver.SQLServerDriver"  
jdbc\_connection\_string =\> "jdbc:sqlserver://MYSERVER:1433;DatabaseName=DB"  
jdbc\_user =\> "user"  
jdbc\_password =\> "password"  
statement\_filepath =\> "C:\Temp\TransactionEntity.sql"  
jdbc\_paging\_enabled =\> true  
jdbc\_page\_size =\> 1000  
}  
}

filter {  
mutate {  
remove\_field =\> ["@timestamp", "@version"]  
}  
}

output {  
elasticsearch {  
hosts =\> ["127.0.0.1:9200"]  
manage\_template =\> false  
action =\> "index"  
index =\> "ed"  
document\_type =\> "TransactionEntity"   
}  
}

Below is the command i am running in CMD

C:\ES\logstash-5.6.4\bin\>logstash --debug -f C:\ES\DataLoad\TransactionEntity.conf

Getting below Error -

] Successfully started Logstash API endpoint {:port=\>9600}  
[2017-11-24T09:31:59,802][DEBUG][logstash.inputs.jdbc] closing {:plugin=\>"LogStash::Inputs::Jdbc"}  
[2017-11-24T09:31:59,802][DEBUG][logstash.pipeline] Input plugins stopped! Will shutdown filter/output workers.  
[2017-11-24T09:31:59,896][DEBUG][logstash.pipeline] Pushing flush onto pipeline  
[2017-11-24T09:31:59,896][DEBUG][logstash.pipeline] Pushing shutdown {:thread=\>"#\<Thread:0x1cd33ce sleep\>"}  
[2017-11-24T09:31:59,896][DEBUG][logstash.pipeline] Pushing shutdown {:thread=\>"#\<Thread:0x1485822 run\>"}  
[2017-11-24T09:31:59,896][DEBUG][logstash.pipeline] Pushing shutdown {:thread=\>"#\<Thread:0x125ed04 sleep\>"}  
[2017-11-24T09:31:59,896][DEBUG][logstash.pipeline] Pushing shutdown {:thread=\>"#\<Thread:0x246792 sleep\>"}  
[2017-11-24T09:31:59,896][DEBUG][logstash.pipeline] Shutdown waiting for worker thread #Thread:0x1cd33ce  
[2017-11-24T09:31:59,927][DEBUG][logstash.agent] Error in reactor loop escaped: Bad file descriptor - Bad file descriptor (Errno::EBADF)  
[2017-11-24T09:31:59,943][DEBUG][logstash.agent] ["org/jruby/RubyIO.java:3705:in `select'", "C:/ES/logstash-5.6.4/vendor/bundle/jruby/1.9/gems/puma-2.16.0-java/lib/puma/reactor.rb:29:in`run\_internal'", "C:/ES/logstash-5.6.4/vendor/bundle/jruby/1.9/gems/puma-2.16.0-java/lib/puma/reactor.rb:138:in `run_in_thread'"] [2017-11-24T09:31:59,943][DEBUG][logstash.agent] 2017-11-24 09:31:59 +0530: Listen loop error: #<Errno::EBADF: Bad file descriptor - Bad file descriptor> [2017-11-24T09:31:59,943][DEBUG][logstash.agent] org/jruby/RubyIO.java:3705:in`select'  
C:/ES/logstash-5.6.4/vendor/bundle/jruby/1.9/gems/puma-2.16.0-java/lib/puma/server.rb:322:in `handle_servers' C:/ES/logstash-5.6.4/vendor/bundle/jruby/1.9/gems/puma-2.16.0-java/lib/puma/server.rb:296:in`run'  
[2017-11-24T09:31:59,943][DEBUG][logstash.agent] 2017-11-24 09:31:59 +0530: Listen loop error: #\<Errno::EBADF: Bad file descriptor - Bad file descriptor\>  
[2017-11-24T09:31:59,943][DEBUG][logstash.agent] Error in reactor loop escaped: Bad file descriptor - Bad file descriptor (Errno::EBADF)  
[2017-11-24T09:31:59,943][DEBUG][logstash.agent] org/jruby/RubyIO.java:3705:in `select'

Kindly help on this .

Thanks in advance !

Arun

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [December 22, 2017, 4:31am UTC](https://discuss.elastic.co/t/error-in-logstash-agent-bad-file-descriptor-errno-ebadf/108961/2 "2017-12-22T04:31:24Z")

</div>

Closed on December 22, 2017, 4:31am UTC

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