Deluge causes conflict with Samba or disk driver

General support for problems installing or using Deluge
Post Reply
havranek
New User
New User
Posts: 5
Joined: Mon Apr 04, 2022 9:22 pm

Deluge causes conflict with Samba or disk driver

Post by havranek »

Hi!
I've been using Deluge since couple of months on Raspberry Pi 4 with Raspbian 64 bit (Debian Bullseye). I have several services and servers running on it. Also, there are two external drives attached to it and shared with Samba. After installing Deluge 2.0.3, problems with shared folders started to occur. The shares just disappear some time after starting deluged. Running deluge-console or deluge-web just makes this happen much faster. What is interesting this happens more frequently and faster with the time lapse. In a meantime I even reinstalled the OS suspecting some misconfiguration done by myself before. But it happens even on fresh, clean install of the OS.

When the shares disappear I have to re-mount devices and restart Samba then. After couple of such incidents this becomes insufficient and I need to reboot the machine. This happens every two days. This is simply irritating.

Additionally, some errors started to occur when running any of mentioned applications.

When deluged starts the following errors occur:

Code: Select all

21:09:59 [CRITICAL][twisted                       :154 ] Unhandled error in Deferred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/twisted/internet/base.py", line 913, in runUntilCurrent
    call.func(*call.args, **call.kw)
  File "/usr/lib/python3/dist-packages/deluge/core/torrentmanager.py", line 1492, in on_alert_fastresume_rejected
    log.error('on_alert_fastresume_rejected: %s', alert_msg)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1613, in unwindGenerator
    return _cancellableInlineCallbacks(gen)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks
    _inlineCallbacks(None, g, status)
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/usr/lib/python3/dist-packages/deluge/log.py", line 79, in error
    yield LoggingLoggerClass.error(self, msg, *args, **kwargs)
  File "/usr/lib/python3.9/logging/__init__.py", line 1471, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.9/logging/__init__.py", line 1573, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
builtins.TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given

Temporarily disabling observer LegacyLogObserverWrapper(<bound method TwistedLoggingObserver.emit of <deluge.log.TwistedLoggingObserver object at 0x7f99c0f460>>) due to exception: [Failure instance: Traceback: <class 'TypeError'>: findCaller() takes from 1 to 2 positional arguments but 3 were given
/usr/lib/python3/dist-packages/deluge/core/alertmanager.py:139:<dictcomp>
/usr/lib/python3/dist-packages/twisted/internet/defer.py:962:__del__
/usr/lib/python3/dist-packages/twisted/logger/_logger.py:190:failure
/usr/lib/python3/dist-packages/twisted/logger/_logger.py:144:emit
--- <exception caught here> ---
/usr/lib/python3/dist-packages/twisted/logger/_observer.py:131:__call__
/usr/lib/python3/dist-packages/twisted/logger/_legacy.py:93:__call__
/usr/lib/python3/dist-packages/deluge/log.py:204:emit
/usr/lib/python3.9/logging/__init__.py:1489:critical
/usr/lib/python3.9/logging/__init__.py:1573:_log
]
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/core/alertmanager.py", line 139, in <dictcomp>
    attr: getattr(alert, attr)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 962, in __del__
    log.failure(format,
  File "/usr/lib/python3/dist-packages/twisted/logger/_logger.py", line 190, in failure
    self.emit(level, format, log_failure=failure, **kwargs)
  File "/usr/lib/python3/dist-packages/twisted/logger/_logger.py", line 144, in emit
    self.observer(event)
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/logger/_observer.py", line 131, in __call__
    observer(event)
  File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 93, in __call__
    self.legacyObserver(event)
  File "/usr/lib/python3/dist-packages/deluge/log.py", line 204, in emit
    getattr(LoggingLoggerClass, event_dict['log_level'].name)(
  File "/usr/lib/python3.9/logging/__init__.py", line 1489, in critical
    self._log(CRITICAL, msg, args, **kwargs)
  File "/usr/lib/python3.9/logging/__init__.py", line 1573, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
builtins.TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given
When deluge-web is run they look like this:

Code: Select all

Unhandled error in Deferred:
22:20:54 [CRITICAL][twisted                    :154 ] Unhandled error in Deferred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1116, in _cbDeferred
    self.callback(self.resultList)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 460, in callback
    self._startRunCallbacks(result)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 654, in _runCallbacks
    current.result = callback(current.result, *args, **kw)
  File "/usr/lib/python3/dist-packages/deluge/ui/web/json_api.py", line 190, in _on_rpc_request_failed
    return self._send_response(request, response)
  File "/usr/lib/python3/dist-packages/deluge/ui/web/json_api.py", line 232, in _send_response
    response = json.dumps(response)
  File "/usr/lib/python3.9/json/__init__.py", line 231, in dumps
    return _default_encoder.encode(obj)
  File "/usr/lib/python3.9/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.9/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/lib/python3.9/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
builtins.TypeError: Object of type Failure is not JSON serializable

Temporarily disabling observer LegacyLogObserverWrapper(<bound method TwistedLoggingObserver.emit of <deluge.log.TwistedLoggingObserver object at 0x7f8321ce50>>) due to exception: [Failure instance: Traceback: <class 'TypeError'>: findCaller() takes from 1 to 2 positional arguments but 3 were given
/usr/lib/python3/dist-packages/twisted/internet/defer.py:568:_startRunCallbacks
/usr/lib/python3/dist-packages/twisted/internet/defer.py:962:__del__
/usr/lib/python3/dist-packages/twisted/logger/_logger.py:190:failure
/usr/lib/python3/dist-packages/twisted/logger/_logger.py:144:emit
--- <exception caught here> ---
/usr/lib/python3/dist-packages/twisted/logger/_observer.py:131:__call__
/usr/lib/python3/dist-packages/twisted/logger/_legacy.py:93:__call__
/usr/lib/python3/dist-packages/deluge/log.py:204:emit
/usr/lib/python3.9/logging/__init__.py:1489:critical
/usr/lib/python3.9/logging/__init__.py:1573:_log
]
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 568, in _startRunCallbacks
    self._runCallbacks()
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 962, in __del__
    log.failure(format,
  File "/usr/lib/python3/dist-packages/twisted/logger/_logger.py", line 190, in failure
    self.emit(level, format, log_failure=failure, **kwargs)
  File "/usr/lib/python3/dist-packages/twisted/logger/_logger.py", line 144, in emit
    self.observer(event)
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/logger/_observer.py", line 131, in __call__
    observer(event)
  File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 93, in __call__
    self.legacyObserver(event)
  File "/usr/lib/python3/dist-packages/deluge/log.py", line 204, in emit
    getattr(LoggingLoggerClass, event_dict['log_level'].name)(
  File "/usr/lib/python3.9/logging/__init__.py", line 1489, in critical
    self._log(CRITICAL, msg, args, **kwargs)
  File "/usr/lib/python3.9/logging/__init__.py", line 1573, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
builtins.TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given

Unhandled error in Deferred:
22:20:54 [CRITICAL][twisted                    :154 ] Unhandled error in Deferred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/deluge/transfer.py", line 129, in _handle_complete_message
    self.message_received(
  File "/usr/lib/python3/dist-packages/deluge/ui/client.py", line 169, in message_received
    log.error(msg)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1613, in unwindGenerator
    return _cancellableInlineCallbacks(gen)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1529, in _cancellableInlineCallbacks
    _inlineCallbacks(None, g, status)
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1418, in _inlineCallbacks
    result = g.send(result)
  File "/usr/lib/python3/dist-packages/deluge/log.py", line 79, in error
    yield LoggingLoggerClass.error(self, msg, *args, **kwargs)
  File "/usr/lib/python3.9/logging/__init__.py", line 1471, in error
    self._log(ERROR, msg, args, **kwargs)
  File "/usr/lib/python3.9/logging/__init__.py", line 1573, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
builtins.TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given

Temporarily disabling observer LegacyLogObserverWrapper(<bound method TwistedLoggingObserver.emit of <deluge.log.TwistedLoggingObserver object at 0x7f8321ce50>>) due to exception: [Failure instance: Traceback: <class 'TypeError'>: findCaller() takes from 1 to 2 positional arguments but 3 were given
/usr/lib/python3/dist-packages/twisted/protocols/tls.py:529:_write
/usr/lib/python3/dist-packages/twisted/internet/defer.py:962:__del__
/usr/lib/python3/dist-packages/twisted/logger/_logger.py:190:failure
/usr/lib/python3/dist-packages/twisted/logger/_logger.py:144:emit
--- <exception caught here> ---
/usr/lib/python3/dist-packages/twisted/logger/_observer.py:131:__call__
/usr/lib/python3/dist-packages/twisted/logger/_legacy.py:93:__call__
/usr/lib/python3/dist-packages/deluge/log.py:204:emit
/usr/lib/python3.9/logging/__init__.py:1489:critical
/usr/lib/python3.9/logging/__init__.py:1573:_log
]
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/twisted/protocols/tls.py", line 529, in _write
    sent = self._tlsConnection.send(toSend)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 962, in __del__
    log.failure(format,
  File "/usr/lib/python3/dist-packages/twisted/logger/_logger.py", line 190, in failure
    self.emit(level, format, log_failure=failure, **kwargs)
  File "/usr/lib/python3/dist-packages/twisted/logger/_logger.py", line 144, in emit
    self.observer(event)
--- <exception caught here> ---
  File "/usr/lib/python3/dist-packages/twisted/logger/_observer.py", line 131, in __call__
    observer(event)
  File "/usr/lib/python3/dist-packages/twisted/logger/_legacy.py", line 93, in __call__
    self.legacyObserver(event)
  File "/usr/lib/python3/dist-packages/deluge/log.py", line 204, in emit
    getattr(LoggingLoggerClass, event_dict['log_level'].name)(
  File "/usr/lib/python3.9/logging/__init__.py", line 1489, in critical
    self._log(CRITICAL, msg, args, **kwargs)
  File "/usr/lib/python3.9/logging/__init__.py", line 1573, in _log
    fn, lno, func, sinfo = self.findCaller(stack_info, stacklevel)
builtins.TypeError: findCaller() takes from 1 to 2 positional arguments but 3 were given
I guess they may be related to loosing Samba shares. But this is only my guess.

Any ideas?

Thanks for help.
havranek
New User
New User
Posts: 5
Joined: Mon Apr 04, 2022 9:22 pm

Re: Deluge causes conflict with Samba or disk driver

Post by havranek »

Hi!

Another thing I can confirm is that after a time, perhaps related to a certain number of restoring Samba share on the disk (which include re-mounting), the file structure gets corrupted. This points rather to disk driver conflict, than Samba itself, but I can be wrong. This is not so scary because it can be easily fixed using standard tools. I noticed such a behavior with the disk formated as NTFS as well as ext4.
It is still worth to remember that without deluge running none of those described above happens and the disk works without interruption or errors for months.

Thanks in advance for any ideas.
shamael
Compulsive Poster
Compulsive Poster
Posts: 667
Joined: Sat Oct 08, 2016 9:28 am

Re: Deluge causes conflict with Samba or disk driver

Post by shamael »

Hi,

I use samba with torrent for years w/o issue so far. My first guess regarding your behaviour is a bus reset on the USB, where the external disks reside. This will explain why the share are gone (disconnection). Check with "sudo dmesg -T" for anyhting related to disk when it happens
havranek
New User
New User
Posts: 5
Joined: Mon Apr 04, 2022 9:22 pm

Re: Deluge causes conflict with Samba or disk driver

Post by havranek »

Thanks for the suggestion. I did it and found lots of messages like this:

Code: Select all

Buffer I/O error on dev sdc1, logical block 36, async page read
This explains why after longer periods of time I receive message that disk is corrupted. But the question is why these errors do occur.
shamael
Compulsive Poster
Compulsive Poster
Posts: 667
Joined: Sat Oct 08, 2016 9:28 am

Re: Deluge causes conflict with Samba or disk driver

Post by shamael »

This should be a fixable problem but points to a block issue indeed. It should not comes from the usage but well a damage/bad block.
you'll find guidance on the net for this, most of the time a smartctl to have a first report then a write to the concerned block so the disk swap it with an available one (reserve).

I use to run a smartctl task if not everyday at least once a week for all my drives. You may have it automatically set or not depending your Linux distribution. If such happens again, consider a drive swap and certainly a backup of your data
havranek
New User
New User
Posts: 5
Joined: Mon Apr 04, 2022 9:22 pm

Re: Deluge causes conflict with Samba or disk driver

Post by havranek »

Thanks for your advice. I also think that is fixable. The thing that makes me confused is that the same disk is able to work without any errors and restarts for a long time when Deluge is not installed and running. It was just my network share for Windows backups. My suspicions lead me to some correlation with Python rather than Deluge itself. But this may be a false trail.

All in all, that is an interesting issue. It may be also connected to power efficiency of USB ports of Raspberry Pi. The problematic hard drive is one of two hard drives connected directly to RPi without any externally powered USB hub. The second drive is smaller and less demanding and seems to be more tolerant, however sometimes it happens also that it disappears from samba. This may seem not so obvious, but powering issues often give misleading symptoms. I have to check it.

Anyway, I'll use the samartctl as you suggested first.
shamael
Compulsive Poster
Compulsive Poster
Posts: 667
Joined: Sat Oct 08, 2016 9:28 am

Re: Deluge causes conflict with Samba or disk driver

Post by shamael »

A bad block is a physical problem. As all the software layer use the OS storage stack I don't see how this can be misused. But the way you power the drives (USB for RPI) can :). You can safely power an SSD (not the last NVMe however) but HDD tends to consume more power with ages. Try to use self powered device or a good USB powered hub
havranek
New User
New User
Posts: 5
Joined: Mon Apr 04, 2022 9:22 pm

Re: Deluge causes conflict with Samba or disk driver

Post by havranek »

I've been watching the behavior of the system since a couple of days when started to use externally powered USB hub for attached hdd. So far, it seems that all the problems gone. There are no more python errors (as pointed in my first post), there are no more I/O errors showed by dmesg -T, and finally, Samba shares have been available without interruption for 4 days so far. All of that works without flaws despite deluge-web running all the time. Before, running deluge-web just caused these problems to appear much faster than without it and I had to reboot the system once a day at least.
Thanks shamael for your time and suggestions.
Post Reply