Closed lookcrabs closed 5 years ago
Hi,
Thank you for the bug report ! I believe your fix is correct, and pushed it to master, does that fix the issue ?
I tried the fix and now I receive an IO error on f.close() when trying to use your plugin. I am still trying to figure out what the cause of this is though. Was planning on opening another issue if/once I figure it out at all.
Still relatively new to python/programming/bareos.
f.close()
?
Can you give me the full error / stack ?
Here is the full stack. Sorry I had to re-download, install and configure the plugin again.
24-May 14:40 kg10-19-fd JobId 436: Fatal error: python-fd: Traceback (most recent call last):
File "/usr/lib/bareos/plugins/BareosFdWrapper.py", line 38, in handle_plugin_event
return bareos_fd_plugin_object.handle_plugin_event(context, event)
File "/usr/lib/bareos/plugins/BareosFdPluginBaseclass.py", line 223, in handle_plugin_event
return self.start_backup_job(context)
File "/usr/lib/bareos/plugins/BareosFdPluginRGW.py", line 330, in start_backup_job
writer = Writer(self.plugin_todo_queue, self.pref_todo_queue, self.last_run, self.options, self.prefetchers)
File "/usr/lib/bareos/plugins/BareosFdPluginRGW.py", line 147, in __init__
self.driver = connect(self.options)
File "/usr/lib/bareos/plugins/BareosFdPluginRGW.py", line 85, in connect
driver = get_driver(getattr(Provider, options['provider']))(**options)
File "/usr/local/lib/python2.7/dist-packages/libcloud/storage/providers.py", line 93, in get_driver
deprecated_constants=deprecated_constants)
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/providers.py", line 72, in get_driver
_mod = __import__(mod_name, globals(), locals(), [driver_name])
File "/usr/local/lib/python2.7/dist-packages/libcloud/storage/drivers/rgw.py", line 17, in <module>
from libcloud.common.aws import SignedAWSConnection, DEFAULT_SIGNATURE_VERSION
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/aws.py", line 29, in <module>
from libcloud.common.base import ConnectionUserAndKey, XmlResponse, BaseDriver
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/base.py", line 27, in <module>
import requests
File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 97, in <module>
from . import utils
File "/usr/local/lib/python2.7/dist-packages/requests/utils.py", line 42, in <module>
if platform.system() == 'Windows':
File "/usr/lib/python2.7/platform.py", line 1286, in system
return uname()[0]
File "/usr/lib/python2.7/platform.py", line 1253, in uname
processor = _syscmd_uname('-p','')
File "/usr/lib/python2.7/platform.py", line 988, in _syscmd_uname
rc = f.close()
IOError: (10, 'No child processes')
24-May 14:40 kg10-19-fd JobId 436: Fatal error: fd_plugins.c:656 Command plugin "python:module_path=/usr/lib/bareos/plugins:module_name=bareos-fd-rgw:provider=S3_RGW:key=X_ACCESS_X:secret=X_SECRET_X:host=X_HOST_X:buckets_include=bucketa,bucketb,bucketc,bucketd:secure=True" requested, but is not loaded.
Ha, you are using a windows platform, I have not tested anything there Your output looks like the one from another project: https://github.com/MycroftAI/mycroft-core/issues/715
I pushed a commit on a specific branch (see https://github.com/JackSlateur/bareos-libcloud/tree/fix-1), without testing it : does it helps ?
Not using windows at all. Saw that and thought it was weird::
root@kg10-19:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
root@kg10-19:~# uname -a
Linux kg10-19 4.13.0-37-generic #42~16.04.1-Ubuntu SMP Wed Mar 7 16:03:28 UTC 2018 x86_64
x86_64 x86_64 GNU/Linux
root@kg10-19:~# python -c 'import platform; print(platform.system())'
Linux
Humhum, weird indeed
Can you try that branch anyway ?
Oh wonky. Never seen this weirdness before. I restarted bareos after pulling your new script and seeing how it goes now. Looks promising though:
24-May 17:11 bareos-sd JobId 437: Spooling data ...
24-May 17:14 kg10-19-fd JobId 437: python-fd: Starting backup of /bucket/key-name.bam
I'll let you know how this goes. It does look like reordering the signal ignore fixed it so far. So weird. Thank you so much!
If it's okay with you. I am going to leave this open for a bit and will close it tomorrow?
Of course !
I'm an idiot and I forgot I swapped out the config to point towards my attempt at making a plugin. I switched it back and I still get the same error. I'm very sorry for the confusion.
25-May 11:01 kg10-19-fd JobId 445: Fatal error: python-fd: Traceback (most recent call last):
File "/usr/lib/bareos/plugins/BareosFdWrapper.py", line 38, in handle_plugin_event
return bareos_fd_plugin_object.handle_plugin_event(context, event)
File "/usr/lib/bareos/plugins/BareosFdPluginBaseclass.py", line 223, in handle_plugin_event
return self.start_backup_job(context)
File "/usr/lib/bareos/plugins/BareosFdPluginRGW.py", line 323, in start_backup_job
writer = Writer(self.plugin_todo_queue, self.pref_todo_queue, self.last_run, self.options, self.prefetchers)
File "/usr/lib/bareos/plugins/BareosFdPluginRGW.py", line 142, in __init__
self.driver = connect(self.options)
File "/usr/lib/bareos/plugins/BareosFdPluginRGW.py", line 80, in connect
driver = get_driver(getattr(Provider, options['provider']))(**options)
File "/usr/local/lib/python2.7/dist-packages/libcloud/storage/providers.py", line 93, in get_driver
deprecated_constants=deprecated_constants)
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/providers.py", line 72, in get_driver
_mod = __import__(mod_name, globals(), locals(), [driver_name])
File "/usr/local/lib/python2.7/dist-packages/libcloud/storage/drivers/rgw.py", line 17, in <module>
from libcloud.common.aws import SignedAWSConnection, DEFAULT_SIGNATURE_VERSION
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/aws.py", line 29, in <module>
from libcloud.common.base import ConnectionUserAndKey, XmlResponse, BaseDriver
File "/usr/local/lib/python2.7/dist-packages/libcloud/common/base.py", line 27, in <module>
import requests
File "/usr/local/lib/python2.7/dist-packages/requests/__init__.py", line 97, in <module>
from . import utils
File "/usr/local/lib/python2.7/dist-packages/requests/utils.py", line 42, in <module>
if platform.system() == 'Windows':
File "/usr/lib/python2.7/platform.py", line 1286, in system
return uname()[0]
File "/usr/lib/python2.7/platform.py", line 1253, in uname
processor = _syscmd_uname('-p','')
File "/usr/lib/python2.7/platform.py", line 988, in _syscmd_uname
rc = f.close()
IOError: (10, 'No child processes')
Here is the md5: e07082d2aa7e5ab86aa2c0de5fdb0295 /usr/lib/bareos/plugins/BareosFdPluginRGW.py
I did pull the correct patch though afaik so it looks like moving it didn't fix it:
def start_backup_job(self, context):
self.manager = multiprocessing.Manager()
self.plugin_todo_queue = self.manager.Queue(maxsize=self.options['queue_size'])
self.pref_todo_queue = self.manager.Queue(maxsize=self.options['nb_prefetcher'])
self.prefetchers = list()
for i in range(0, self.options['nb_prefetcher']):
target = Prefetcher(self.options, self.plugin_todo_queue, self.pref_todo_queue)
proc = multiprocessing.Process(target=target)
proc.start()
self.prefetchers.append(proc.pid)
log('%s prefetcher started' % (len(self.prefetchers),))
writer = Writer(self.plugin_todo_queue, self.pref_todo_queue, self.last_run, self.options, self.prefetchers)
self.writer = multiprocessing.Process(target=writer)
self.writer.start()
self.driver = connect(self.options)
# We do not care much about our slaves
# To avoid both .join() and zombies, simply ignore SIG_CHILD
# Put this after the connect(), because it triggers a bug
# somewhere on windows-platforms
signal.signal(signal.SIGCHLD, signal.SIG_IGN)
def check_file(self, context, fname):
So sorry for the confusion.
It looks like libcloud uses requests and I found an old request bug that mentioned the same bug. Bumped it up to 2.18 and the error persists. :-(
I set up a lab for testing, using:
It does not works (not your error, through), bareos 14.2 is the issue (the python plugin does not work the same)
I then upgraded to python-libcloud 2.2.1-1 (from bionic) and bareos-* 17.2.4-9.1 (from http://download.bareos.org/bareos/release/latest/xUbuntu_16.04/, I did not find the package in bionic) The plugin works fine then
Can you give me your packages versions, so that I can test them exactly ?
I'm using bareos 17.2.4-9.1 (same version)
ii bareos 17.2.4-9.1 amd64 Backup Archiving Recovery Open Sourced - metapackage
root@kg10-19:/etc/bareos/bareos-dir.d/fileset# pip freeze
apache-libcloud==2.3.0
awscli==1.9.0
beautifulsoup4==4.4.1
boto3==1.6.9
botocore==1.9.9
certifi==2018.4.16
chardet==3.0.4
colorama==0.3.3
decorator==4.0.6
docutils==0.14
futures==3.2.0
html5lib==0.999
idna==2.6
ipython==2.4.1
jmespath==0.9.3
lxml==3.5.0
pexpect==4.0.1
ptyprocess==0.5
pyasn1==0.4.2
python-dateutil==2.6.1
PyYAML==3.12
requests==2.18.4
rsa==3.3
s3transfer==0.1.13
simplegeneric==0.8.1
six==1.11.0
urllib3==1.22
I will try downgrading libcloud to 2.2.1 and see if that works.
Same error.
At this point I just removed the sig_ign line entirely and trying now. I know it's in there to prevent zombies (when debugging?) but maybe it's not needed? I notice in the project you linked to that the signal line was completely removed as well.
What are the results of your last experiment ?
On my side, I sadly cannot reproduce your issue
I encourage you to use a clean Python installation from your distribution and try again
File "/usr/lib/bareos/plugins/BareosFdPluginRGW.py", line 296, in __parse_options if self.options['debug'] is True: KeyError: ('debug',)
I think the self.options['debug'] needs to go under the if 'debug' in self.options?