Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fall-through for bytesToHuman for very large values (just print the bytes) #858

Closed
wants to merge 2 commits into from

Conversation

dvdplm
Copy link
Contributor

@dvdplm dvdplm commented Jan 2, 2013

We have seen an issue where an instance had a very large peak memory usage: used_memory_peak:18446744073706301432. The bytesToHuman() function can't stringify that properly (we get: used_memory_peak_human:\x90\f\x83\xFB\x83\u007F) so here's a version that resorts to simply printing the bytes for too-large values.

@charsyam
Copy link
Contributor

charsyam commented Jan 2, 2013

@dvdplm I just have a question about your environment. Do you really use more than 15EB memory?

It is because 15EB overflow double's range. but, I really wonder in your environment.

@dvdplm
Copy link
Contributor Author

dvdplm commented Jan 2, 2013

It's an AWS m2.xlarge instance, so yeah, it has 17.1Gb. There are plenty of 64Gb servers out there, so it's not like this is a particularly exotic situation right?

@charsyam
Copy link
Contributor

charsyam commented Jan 2, 2013

Hmm. it's somewhat weird. because "used_memory_peak" is more than 15EB not 15GB in your report.

@dvdplm
Copy link
Contributor Author

dvdplm commented Jan 2, 2013

Hehe, you're right, it is a weirdly high value (and I have no explanation for it, unfortunately). Maybe that's another unrelated bug?
Either way, I think the bytesToHuman should be able to deal with any kind of crazy value. I mean, it's simply a string formatting helper function and it should simply work and not encode/require any knowledge about what "valid" values are here.

@charsyam
Copy link
Contributor

charsyam commented Jan 2, 2013

@dvdplm Yes, I think that it is first to look for what makes it strange.

In my personal opinion, "used_memory_peak" already shows not encoded value.

so, I think adding "TB", "PB", "EB", "ZB", "YB" is better.

@dvdplm
Copy link
Contributor Author

dvdplm commented Jan 2, 2013

@charsyam from PB onwards I'm getting compiler warnings about comparison of unsigned expression < 0 is always false and potential division by zero issues, so I stopped at TB and PB (and kept the final rescue with a note saying it's an exceptional case). You like better?

@charsyam
Copy link
Contributor

charsyam commented Jan 2, 2013

@dvdplm maybe there is no possibility to use more than PB size memory in next 10 years. :)
I just worry about what makes "used_memory_peak" weird.

mattsta pushed a commit to mattsta/redis that referenced this pull request Aug 2, 2014
Also adds a fallthrough case for when given
large values (like overflow numbers of 2^64 by mistake).

Closes redis#858
mattsta pushed a commit to mattsta/redis that referenced this pull request Aug 2, 2014
Also adds a fallthrough case for when given
large values (like overflow numbers of 2^64 by mistake).

Closes redis#858
@mattsta mattsta mentioned this pull request Aug 2, 2014
mattsta pushed a commit to mattsta/redis that referenced this pull request Aug 6, 2014
Also adds a fallthrough case for when given
large values (like overflow numbers of 2^64 by mistake).

Closes redis#858
@antirez antirez closed this in 100c331 Aug 25, 2014
antirez pushed a commit that referenced this pull request Aug 26, 2014
Also adds a fallthrough case for when given
large values (like overflow numbers of 2^64 by mistake).

Closes #858
antirez pushed a commit that referenced this pull request Aug 27, 2014
Also adds a fallthrough case for when given
large values (like overflow numbers of 2^64 by mistake).

Closes #858
yossigo added a commit to yossigo/redis that referenced this pull request Feb 14, 2022
f8de9a4bd Merge pull request redis#1046 from redis/rockylinux-ci
a41c9bc8b CentOS 8 is EOL, switch to RockyLinux
be41ed60d Avoid incorrect call to the previous reply's callback (redis#1040)
f2e8010d9 fix building on AIX and SunOS (redis#1031)
e73ab2f23 Add timeout support for libuv adapter (redis#1016)
f2ce5980e Allow sending commands after sending an unsubscribe (redis#1036)
ff860e55d Correction for command timeout during pubsub (redis#1038)
24d534493 CMakeLists.txt: allow building without a C++ compiler (redis#872)
4ece9a02e Fix adapters/libevent.h compilation for 64-bit Windows (redis#937)
799edfaad Don't link with crypto libs if USE_SSL isn't set.
f74b08182 Makefile: move SSL options into a block and refine rules
f347743b7 Update CMakeLists.txt for more portability (redis#1005)
f2be74802 Fix integer overflow when format command larger than 4GB (redis#1030)
58aacdac6 Handle array response in parallell with pubsub using RESP3 (redis#1014)
d3384260e Support PING while subscribing (RESP2) (redis#1027)
e3a479e40 FreeBSD build fixes + CI (redis#1026)
da5a4ff36 Add asynchronous test for pubsub using RESP3 (redis#1012)
b5716ee82 Valgrind returns error exit code when errors found (redis#1011)
1aed21a8c Move to using make directly in Cygwin (redis#1020)
a83f4b890 Correct CMake warning for libevent adapter example
c4333203e Remove unused parameter warning in libev adapter
7ad38dc4a Small tweaks of the async tests
4021726a6 Add asynchronous test for pubsub using RESP2
648763c36 Add build options for enabling async tests
c98c6994d Correcting the build target `coverage` for enabled SSL (redis#1009)
30ff8d850 Run SSL tests in CI
4a126e8a9 Add valgrind and CMake to tests
b73c2d410 Add Centos8
e9f647384 We should run actions on PRs
6ad4ccf3c Add Cygwin build test
783a3789c Add Windows tests in GitHub actions
0cac8dae1 Switch to GitHub actions
fa900ef76 Fix unused variable warning.
e489846b7 Minor refactor of CVE-2021-32765 fix.
51c740824 Remove extra comma from cmake var. Or it'll be treated as part of the var name.
632bf0718 Merge branch 'release/v1.0.2'
b73128324 Prepare for v1.0.2 GA
d4e6f109a Revert erroneous SONAME bump
a39824a5d Merge branch 'release/v1.0.1'
8d1bfac46  Prepare for v1.0.1 GA
76a7b1000 Fix for integer/buffer overflow CVE-2021-32765
9eca1f36f Allow to override OPENSSL_PREFIX in Linux
2d9d77518 Don't leak memory if an invalid type is set (redis#906)
f5f31ff9b Added REDIS_NO_AUTO_FREE_REPLIES flag (redis#962)
5850a8ecd Ensure we curry any connect error to an async context.
b6f86f38c Fix README.md
667dbf536 Merge pull request redis#935 from kristjanvalur/pr5
9bf6c250e Merge pull request redis#939 from zmartzone/improve_pr_896_ssl_leak
959af9760 Merge pull request redis#949 from plan-do-break-fix/Typo-corrections
0743f57bb fix(docs): corrects typos in project README
5f4382247 improve SSL leak fix redis/hiredis#896
e06ecf7e4 Ignore timeout callback from a successful connect
dfa33e60b Change order independant push logic to not change behavior.
6204182aa Handle the case where an invalidation is sent second.
d6a0b192b Merge branch 'reader-updates'
410c24d2a Fix off-by-one error in seekNewline
bd7488d27 read: Validate line items prior to checking for object creation callbacks
5f9242a1f read: Remove obsolete comment on nested multi bulk depth limitation
83c145042 read: Add support for the RESP3 bignum type
c6646cb19 read: Ensure no invalid '\r' or '\n' in simple status/error strings
e43061156 read: Additional validation and test case for RESP3 double
c8adea402 redisReply: Fix parent type assertions during double, nil, bool creation
ff73f1f9e redisReply: Explicitly list nil and bool cases in freeReplyObject() switch.
0f9251884 test: Add test case for RESP3 set
33c06dd50 test: Add test case for RESP3 map
397fe2630 read: Use memchr() in seekNewline() instead of looping over entire string
81c48a982 test: Add test cases for RESP3 bool
51e693f4f read: Add additional RESP3 bool validation
790b4d3b4 test: Add test cases for RESP3 nil
d8899fbc1 read: Add additional RESP3 nil validation
96e8ea611 test: Add test cases for infinite and NaN doubles
f913e9b99 read: Fix double validation and infinity parsing
8039c7d26 test: Add test case for doubles
49539fd1a redisReply: Fix - set len in double objects
53a8144c8 Merge pull request redis#924 from cheese1/master
9390de006 http -> https
7d99b5635 Merge pull request redis#917 from Nordix/stack-alloc-dict-iter
4bba72103 Handle OOM during async command callback registration
920128a26 Stack allocate dict iterators
297ecbecb Tiny formatting changes + suppress implicit memcpy warning
f746a28e7 Removed 2 typecasts
940a04f4d Added fuzzer
e4a200040 Merge pull request redis#896 from ayeganov/bugfix/ssl_leak
aefef8987 Free SSL object when redisSSLConnect fails
e3f88ebcf Merge pull request redis#894 from jcohen02/fix/issue893
308ffcab8 Updating SSL connection example
297f6551d Merge pull request redis#889 from redis/wincert
e7dda9785 Formatting
f44945a0a Merge pull request redis#874 from masariello/position-independent-code
74e78498c Merge pull request redis#888 from michael-grunder/nil-push-invalidation
b9b9f446f Fix handling of NIL invalidation messages.
acc917548 Merge pull request redis#885 from gkorland/patch-1
b086f763e clean a warning, remvoe empty else block
b47fae4e7 Merge pull request redis#881 from timgates42/bugfix_typo_terminated
f989670e5 docs: Fix simple typo, termined -> terminated
773d6ea8a Copy error to redisAsyncContext on timeout
e35300a66 add pdb files to packages for MSVC builds
dde6916b4 Add d suffix to debug libraries so that can packaged together with optimized builds (Release, RelWithDebInfo, etc)
3b68b5018 Enable position-independent code
6693863f4 Add support for system CA certificate store on Windows
2a5a57b90 Remove whitespace
1b40ec509 fixed issue with unit test linking on windows with SSL
d7b1d21e8 Merge branch 'master' of github.com:redis/hiredis
fb0e6c0dd Merge pull request redis#870 from michael-grunder/cmake-c99
13a35bdb6 Explicitly set c99 in CMake
bea137ca9 Merge pull request redis#868 from michael-grunder/fix-sockaddr-typo
bd6f86eb6 Fix sockaddr typo
48696e7e5 Don't use non-installed win32.h helper in examples (redis#863)
faa1c4863 Merge tag 'v1.0.0'
5003906d6 Define a no op assert if we detect NDEBUG (redis#861)
ea063b7cc Use development specific versions in master
04a27f480 We can run SSL tests everywhere except mingw/Windows (redis#859)
8966a1fc2 Remove extra whitespace (redis#858)
34b7f7a0f Keep libev's code style (redis#857)
07c3618ff Add static library target and cpack support
REVERT: 00272d669 Rename sds calls so they don't conflict in Redis.

git-subtree-dir: deps/hiredis
git-subtree-split: f8de9a4bd433791890572f7b9147e685653ddef9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants