BingAds / BingAds-Python-SDK

Other
117 stars 162 forks source link

Use of suds-jurko in RHEL 5/6 causes cache poisoning #80

Closed nishantnath closed 3 years ago

nishantnath commented 6 years ago

Reference: https://bugzilla.redhat.com/show_bug.cgi?id=978696#c19

Is there a way to avoid suds altogether? I just had an incident of cache-poisoning with 100GB+ of *.px files in /tmp/suds/ directory leading to disk crash

eric-urban commented 6 years ago

@nishantnath thanks for raising this issue. We will investigate and reply here.

qitia commented 6 years ago

@nishantnath per code https://github.com/BingAds/BingAds-Python-SDK/blob/master/bingads/service_client.py#L35 cache should be write to /tmp/suds/{userid} folder, could you please confirm?

nishantnath commented 6 years ago

Files being written to /tmp/suds/{userid}: suds-*-wsdl.px Files being written to /tmp/suds: suds-*-document.px

eric-urban commented 6 years ago

@nishantnath would something like this work for you?

import shutil
from os import path
from tempfile import gettempdir
import atexit

def remove_suds_cache(remove_suds_cache=False):
    if remove_suds_cache:
        shutil.rmtree(path.join(gettempdir(), 'suds'), ignore_errors=True)
    pass

# Set remove_suds_cache=True to remove the temp suds cache
atexit.register(remove_suds_cache, remove_suds_cache=False)

Currently by default cache removal is not enabled. Of course remove_suds_cache could be modified as needed.

@qitia FYI

wesleybowman commented 6 years ago

The googleads library recently switched from the deprecated suds to zeep

qitia commented 6 years ago

thanks @wesleybowman, we are also evaluating it.

phillbaker commented 5 years ago

There's also now a community supported suds version of suds-jurko https://github.com/suds-community/ (which I'm helping to maintain). Happy to accept PRs there to help with this!

And to clarify the patch mentioned on the original bugzilla link is already applied and released to the released version of suds-community.