This error seems related to Redis: 

http://stackoverflow.com/questions/18430324/redis-error-oom-command-not-allowed-when-used-memory-maxmemory


On Tuesday, August 11, 2015 at 1:09:03 PM UTC-4, piast...@gmail.com wrote:
>
>
> I do not know much about the JVM. I never worked with Java, though I am 
> now working with Clojure. I am getting this error:
>
> clojure.lang.ExceptionInfo: OOM command not allowed when used memory > 
> 'maxmemory'. {:prefix :oom} stack trace: {:class 
> clojure.lang.ExceptionInfo, :message \"OOM command not allowed when used 
> memory > 'maxmemory'.\
>
> We have a server that has 20 gigs of physical RAM, though the app itself 
> has these memory limits: 
>
>   :jvm-opts ["-Xms300m" "-Xmx2000m" "-XX:-UseCompressedOops"]
>
> I saw that Sean Corfield posted this code to track memory use, so I have 
> been using this to keep track of my app's memory usage: 
>
> (defn- memory-bean
>   "Return the MemoryMXBean."
>   []
>   (java.lang.management.ManagementFactory/getMemoryMXBean))
>
> (defn- heap-usage
>   "Given a MemoryMXBean, return the heap memory usage."
>   [^java.lang.management.MemoryMXBean bean]
>   (.getHeapMemoryUsage bean))
>
> (defn- heap-used-max
>   "Given heap memory usage, return a pair of used/max values."
>   [^java.lang.management.MemoryUsage usage]
>   [(.getUsed usage) (.getMax usage)])
>
> (defn memory-usage
>   "Return percentage, used, max heap as strings."
>   []
>   (let [used-max (-> (memory-bean) (heap-usage) (heap-used-max))]
>     (cons (as-percentage used-max)
>           (as-megabytes used-max))))
>
>
> Right now I have this run every 60 seconds, so I can keep track of what is 
> happening in my app. In my logs, a few seconds after I get the OOM error, I 
> see this output: 
>
> Resource usage:  
> Memory in use (percentage/used/max-heap): (\"6%\" \"228M\" \"3342M\")
> CPU usage (how-many-cpu's/load-average):  [6 1.81]
> Free memory in jvm: [363319552]"
>
> Perhaps I am reading this wrong? It looks like the app is not using much 
> RAM, yet I get an OOM error? This leaves me confused. 
>
> In the stacktrace, the line that triggers the OOM error is a line where I 
> write a string into Redis, using the Carmine library: 
>
>     (carmine/hset document-id "alert" alert-as-string)
>
> But the string alert-as-string is very small, only about 200 characters, 
> so I can not imagine how that puts any strain on memory. 
>
>
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to