Skip to content

Hedis hangs on reading big zset #15

Closed
@k-bx

Description

@k-bx

Here is a piece of code:

{-# LANGUAGE OverloadedStrings #-}

import Database.Redis
import System.Random
import qualified Data.ByteString.Char8 as BC8

main :: IO ()
main = do
  conn <- connect (defaultConnectInfo { connectHost="localhost" })

  stdGen <- getStdGen
  runRedis conn (fillBigZset stdGen 20000)

  resp <- runRedis conn $ zrangebyscoreLimit "bigzset" 0 1403194724 0 15000
  putStrLn $ "Response: " ++ show resp
  return ()

fillBigZset :: (RedisCtx m f, RandomGen t)
            => t -> Int -> m ()
fillBigZset _ 0 = return ()
fillBigZset gen n = do
    let (v, newGen) = randomR (1,1000000) gen
    _ <- zadd "bigzset" [(v, BC8.pack ("value-value-value-value-value-" ++ show v))]
    fillBigZset newGen (n - 1)

You can comment out 2 lines that fill redis after first time you run it. On my machine, this hangs with redis 2.6. Also tried with latest 2.8 one.

strace output: https://gist.github.com/k-bx/cd3cb178412ea9c50e71

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions