This discussion has been locked. The information referenced herein may be inaccurate due to age, software updates, or external references.
You can no longer post new replies to this discussion. If you have a similar question you can start a new discussion in this forum.

Problem With Python Swis Client

I'm wondering if anyone has run into this issue with the python swis client.

I've been using it to step through a set of switches and then interfaces on each switch.  My script looks to see if the interface should be monitored or not then removes it from NPM if it is there and should not be monitored or adds it to NPM if it is not there and should be monitored.

The script works exactly as expected except that at some point in the process it fails with a 403 forbidden error.  The Orion GUI is inaccessible for a period of time (about 10 minutes I believe).  The Orion.InformationService file displays an error 'Service was unable to open new database connection when requested' and 'InvalidOperationException: Timeout expired.  The timeout period elapsed prior to obtaining a connection from the pool.  This may have occurred because all pooled connections were in use and max pool size was reached.'

So I thought the script may be throwing too many transactions at the database too quickly.  But I tried to test this idea and it doesn't seem to hold.  On the last failure the script failed after deleting 118 interfaces in 2 min 53 secs.  With the GUI I set 167 interfaces to be removed.  That process took 3 seconds.  The InformationService log for the deletions look exactly the same if the deletion was with the GUI as with it was with the script.

So with the GUI I delete more interfaces in much less time.

I'm pretty new to Solarwinds so may be missing something obvious.  Any thoughts are appreciated.

  • tdanner​, would you please review and provide some notes?

  • Without seeing the script I am kind of guessing what's going on here. But here's my guess: the script is deleting interfaces one at a time, but the GUI is deleting them as a batch. It looks like the python swis client doesn't actually have a method for doing bulk delete, even though the underlying REST API does support that operation. You could add this yourself:

    def bulkdelete(self, uris):
        self._req("POST", "BulkDelete", {'uris': uris})

    I opened https://github.com/solarwinds/orionsdk-python/issues/43 to track this.

    Assuming my theory about deleting one-by-one vs. deleting as a batch is correct, then it looks like there is also a problem with database connection pooling in some service. You would expect bulk delete to be faster than separate deletes, but you would not expect single deletes to start throwing database errors.

  • Thanks!  That sounds like it could very well be a practical solution.  I'll give it a try as soon as possible and update you.

  • I created a copy of the swisclient this morning and added the bulkdelete method you suggested.  I tweaked the script to gather up all of the nodes to delete for a given node and then do a bulkdelete and so far it is working fine.

    Thank You!

  • I just ran the full script using the bulk delete instead of the individual deletes and I did have the same issue.  I believe the bulkdelete did help but it seems like when I do something with the api the connection to the data base must be held open longer than expected so the pool is eventually depleted.