Commit Graph

768 Commits

Author SHA1 Message Date
cc8ac74a37 Put good and bad UTF-8 into one of the test data files 2019-08-13 16:08:39 -04:00
3be904d158 Work around a Numpy deprecation warning 2019-08-13 16:07:57 -04:00
5d9fc5500c Make httpclient.put take a content-type instead of picking one
No reason to push the content-type decision into httpclient
2019-08-13 16:07:00 -04:00
57751f5b32 Consistently use bytes everywhere for stream data
Previous commits went back and forth a bit on whether the various APIs
should use bytes or strings, but bytes appears to be a better answer,
because actual data in streams will always be 7-bit ASCII or raw
binary.  There's no reason to apply the performance penalty of
constantly converting between bytes and strings.

One drawback now is that lots of code now has to have "b" prefixes on
strings, especially in tests, which inflates this commit quite a bit.
2019-08-13 15:53:05 -04:00
1c005518d8 Remove old unicode helpers 2019-08-01 17:49:08 -04:00
3279f7ef2c Fix misnamed function 2019-08-01 17:39:32 -04:00
a2e124f444 Make command a required argument for new argparse changes 2019-08-01 17:38:01 -04:00
6d673bd2be Fix commandline test character encoding issues for Py3 2019-08-01 17:38:01 -04:00
613a3185e3 Avoid FutureWarning from Numpy 2019-08-01 17:38:01 -04:00
c83ee65cf7 Fix integer divisions for Python 3 2019-08-01 17:38:01 -04:00
113633459d Don't wait for thread to exit in __del__
This can hit a deadlock waiting for the thread to exit.  We don't
need to wait; it will die when it can, or get terminated when the
interpreter exits.
2019-08-01 17:38:01 -04:00
41abf53085 Remove references to local copy of datetime_tz 2019-08-01 17:38:01 -04:00
fef3e1d31e Fix various string/bytes issues with Python 3 2019-08-01 17:37:45 -04:00
02db87eee6 Fix encoding issues in HTTP chunked responses 2019-08-01 17:36:44 -04:00
ad85c3dd29 CherryPy bug 1200 is no longer an issue 2019-08-01 17:36:44 -04:00
0e6ccd687b Fix missing Exception.message in Python 3 2019-08-01 17:36:44 -04:00
85d4c419fd Decode server responses from raw bytes to strings
Uses utf-8, or whatever the server response indicates.
2019-08-01 17:36:44 -04:00
159278066c Fix datetime_tz import 2019-08-01 17:36:44 -04:00
b69358a185 Fix error with reraising exceptions in serializer 2019-08-01 17:36:44 -04:00
e82ef60e2e Response bodies in HTTP are raw bytes 2019-08-01 17:36:44 -04:00
911d9bc284 Encode Unicode to raw bytes for server responses 2019-08-01 17:36:44 -04:00
752a9b36ae Use Python 3 super(), and add self.message back to my exceptions 2019-08-01 17:36:44 -04:00
97d17de8ad Port bulkdata and rocket to Python 3
Main change is to use raw bytes for filenames everywhere
2019-08-01 17:36:44 -04:00
5da7e6558e Fix interval comparisons for Python 3 2019-08-01 17:36:44 -04:00
1928caa1d7 Use pip version of datetime_tz; fix timestamper test 2019-08-01 17:36:44 -04:00
5db034432c Update mustclose and test_mustclose for Python 3 (this was hard!) 2019-08-01 17:36:44 -04:00
55119a3e07 Port cython and C code to python 3 2019-08-01 17:36:44 -04:00
a9eff10dbf Fix 2to3 mistake 2019-08-01 17:36:44 -04:00
0f5c1c0db6 Run 2to3 automatic fixes over entire tree 2019-07-25 10:35:30 -04:00
d17365ca37 Update build system for Python 3 2019-07-25 10:34:20 -04:00
8125d9c840 Fix nilmdb-fsck issue caused by 022b50950f 2015-06-24 22:14:27 -04:00
ba55ad82f0 Use a pure-python version of bisect_left, to fix 32-bit issues
The default bisect module includes a fast C implementation, which
requires that array indices fit within the system "long" type.  For
32-bit systems, that's not acceptable, as the table indices for raw
data can exceed 2^32 very quickly.  A pure python version works fine.
2015-01-20 18:31:58 -05:00
45c81d2019 Fix test that would fail if reordered, or in a different timezone 2015-01-18 17:50:54 -05:00
78cfda32e3 Handle another exception from some versions of dateutil.parser 2015-01-18 17:50:54 -05:00
3658d3876b Rename deprecated config option
The new version works in Cherrypy 3.2
2015-01-18 17:50:54 -05:00
022b50950f Support using a higher initial nrows in bulkdata, for tests
This gives an easy way to get a large values in the database start_pos
and end_pos fields, which is necessary for testing failure modes when
those get too large (e.g. on 32-bit systems).  Adjust tests to make
use of this knob.
2015-01-18 17:49:52 -05:00
e5efbadc8e fsck: row indices are too big for slice.indices, so calculate manually
Normally, indexes for an array are expected to fit in a platform's
native long (32 or 64-bit).  In nilmdb, tables aren't real arrays and
we need to handle unbounded indices.
2015-01-18 16:36:56 -05:00
74f633c9da Distribute was merged back into setuptools, so use setuptools 2015-01-18 16:33:58 -05:00
ab9a327130 Remove upper limit on requests library version 2014-02-18 16:36:34 -05:00
da72fc9777 Explicitly avoid HTTP/1.1 persistent connections (keep-alive)
We do this by creating a new requests.Session object for each request,
sending a "Connection: close" request header, and then explicitly
marking the connection for close after the response is read.

This is to avoid a longstanding race condition with HTTP keepalive
and server timeouts.  Due to data processing, capture, etc, requests
may be separated by an arbitrary delay.  If this delay is shorter
than the server's KeepAliveTimeout, the same connection is used.
If the delay is longer, a new connection is used.  If the delay is
the same, however, the request may be sent on the old connection at
the exact same time that the server closes it.  Typically, the
client sees the connection as closing between the request and the
response, which leads to "httplib.BadStatusLine" errors.

This patch avoids the race condition entirely by not using persistent
connections.

Another solution may be to detect those errors and retry the
connection, resending the request.  However, the race condition could
potentially show up in other places, like a closed connection during
the request body, not after.  Such an error could also be a legitimate
network condition or problem.  This solution should be more reliable,
and the overhead of each new connection will hopefully be minimal for
typical workloads.
2014-02-18 14:36:58 -05:00
a01cb4132d Add test for limited interval removal 2014-02-14 15:53:02 -05:00
7c3da2fe44 Limit the max number of intervals we remove in one stream_remove call 2014-02-14 15:52:53 -05:00
f0e06dc436 Allow newer versions of Requests library 2014-02-14 15:13:34 -05:00
ddc0eb4264 Coalesce calls to table.remove during stream_remove; significant speedup for degenerate cases 2014-02-14 15:13:17 -05:00
0a22db3965 Ignore exceptions during __del__ handlers, which may get called during shutdown 2014-02-14 15:07:30 -05:00
8bb8f068de Catch harmless error seen in apache logs during shutdown 2014-02-04 19:50:46 -05:00
416902097d Fix crash in nilmdb-fsck if there are zero intervals, etc. 2014-02-04 19:38:01 -05:00
f5276e9fc8 Test --no-decim 2013-08-16 15:34:35 -04:00
c47f28f93a Fix cache issue in stream_rename
We saw a bug where renamed streams had missing data at the end.  I
think what happened is:

- Write data to /old/path
- Rename to /new/path
- Write data to /new/path
- Cache entry for /old/path gets evicted, file gets truncated

Instead, make sure we evict /old/path right away when renaming.
2013-08-16 15:30:56 -04:00
63b5f99b90 Fix fsck 2013-08-16 15:06:12 -04:00