Skip to content

OSError: [Errno 6] Device not configured #102

Description

@xy-ef

Hi, I use logstash-async in my project, and got an error Device not configured, but the package python-logstash works properly. Anybody know what causes this problem? Thanks.

The code is

# logstash_async doesnot work on my macbook
from logstash_async.handler import AsynchronousLogstashHandler
from logstash_async.formatter import LogstashFormatter

logger = logging.getLogger(logger_name)

logstash_host, logstash_port = get_logstash_config()
logstash_async_handler = AsynchronousLogstashHandler(
    host=logstash_host,
    port=logstash_port,
    database_path=None,
)

logstash_async_formatter = LogstashFormatter(
    message_type="python-logstash",
    extra_prefix="dev"
)

logstash_async_handler.setFormatter(logstash_async_formatter)
logger.addHandler(logstash_async_handler)

My computer is

Apple M3 
Mac OS 14.6

, and the exception stack is as follows, thanks.

2024-12-08 11:05:59: exception: An error occurred while sending events: [Errno 6] Device not configured
Traceback (most recent call last):
  File "/Users/abc.abc/miniconda3/envs/dtc-search-rec/lib/python3.12/site-packages/logstash_async/worker.py", line 138, in _fetch_events
    self._fetch_event()
  File "/Users/abc.abc/miniconda3/envs/dtc-search-rec/lib/python3.12/site-packages/logstash_async/worker.py", line 160, in _fetch_event
    self._event = self._queue.get(block=False)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/abc.abc/miniconda3/envs/dtc-search-rec/lib/python3.12/queue.py", line 168, in get
    raise Empty
_queue.Empty

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/abc.abc/miniconda3/envs/dtc-search-rec/lib/python3.12/site-packages/logstash_async/worker.py", line 241, in _flush_queued_events
    self._send_events(events)
  File "/Users/abc.abc/miniconda3/envs/dtc-search-rec/lib/python3.12/site-packages/logstash_async/worker.py", line 304, in _send_events
    self._transport.send(events, use_logging=use_logging)
  File "/Users/abc.abc/miniconda3/envs/dtc-search-rec/lib/python3.12/site-packages/logstash_async/transport.py", line 103, in send
    self._close()
  File "/Users/abc.abc/miniconda3/envs/dtc-search-rec/lib/python3.12/site-packages/logstash_async/transport.py", line 137, in _close
    self._wait_for_socket_buffer_empty()
  File "/Users/abc.abc/miniconda3/envs/dtc-search-rec/lib/python3.12/site-packages/logstash_async/transport.py", line 150, in _wait_for_socket_buffer_empty
    while time_waited < wait_timeout and not self._is_sock_write_buff_empty():
                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/abc.abc/miniconda3/envs/dtc-search-rec/lib/python3.12/site-packages/logstash_async/transport.py", line 161, in _is_sock_write_buff_empty
    ioctl_result = fcntl.ioctl(socket_fd, termios.TIOCOUTQ, buffer_size)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 6] Device not configured

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions