Re: What causes the text that I print to the terminal to become mangled garbage?

2013-03-13 Thread David Powell
pprint uses refs internally rather than vars.  I was always a bit
suspicious about that...  Perhaps transaction retries are happening?


On Wed, Mar 13, 2013 at 3:19 PM, larry google groups <
lawrencecloj...@gmail.com> wrote:

> > tl;dr concurrency is hard
>
> Jason, if it was just a concurrency issue, it would happen when I use
> pprint. But the above mess only seems to happen with a very specific
> combination of Timbre and thread measuring functions.
>
>
>
>
>
>
> On Wednesday, March 13, 2013 12:16:46 AM UTC-4, Jason Lewis wrote:
>
>> tl;dr concurrency is hard
>>
>> Jason Lewis
>>
>> Email  jasonl...@gmail.com
>>
>> Twitter@canweriotnow 
>>
>> Blog   http://decomplecting.org
>>
>> About http://about.me/jason.lewis
>>
>>
>> On Tue, Mar 12, 2013 at 11:27 PM, Michael Klishin 
>> wrote:
>>
>>> 2013/3/13 larry google groups 
>>>
>>>  At least some of this mangled text is coming from this function, which
 is called at startup and then runs in its own thread
>>>
>>>
>>> If your app itself prints stuff to stdout/stderr, it is likely to be
>>> interleaved with the output from the spying thread.
>>> Thread execution order and time slicing is non-deterministic and nothing
>>> synchronizes writing to stdout/stderr
>>> to enforce ordering.
>>> --
>>> MK
>>>
>>> http://github.com/**michaelklishin 
>>> http://twitter.com/**michaelklishin 
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Clojure" group.
>>> To post to this group, send email to clo...@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+u...@**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+u...@**googlegroups.com.
>>>
>>> For more options, visit 
>>> https://groups.google.com/**groups/opt_out
>>> .
>>>
>>>
>>>
>>
>>  --
> --
> 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/groups/opt_out.
>
>
>

-- 
-- 
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/groups/opt_out.




Re: What causes the text that I print to the terminal to become mangled garbage?

2013-03-13 Thread larry google groups
> tl;dr concurrency is hard
 
Jason, if it was just a concurrency issue, it would happen when I use 
pprint. But the above mess only seems to happen with a very specific 
combination of Timbre and thread measuring functions. 






On Wednesday, March 13, 2013 12:16:46 AM UTC-4, Jason Lewis wrote:
>
> tl;dr concurrency is hard
>
> Jason Lewis
>
> Email  jasonl...@gmail.com  
>
> Twitter@canweriotnow 
>
> Blog   http://decomplecting.org
>
> About http://about.me/jason.lewis
>
>
> On Tue, Mar 12, 2013 at 11:27 PM, Michael Klishin 
> 
> > wrote:
>
>> 2013/3/13 larry google groups >
>>
>>> At least some of this mangled text is coming from this function, which 
>>> is called at startup and then runs in its own thread
>>
>>
>> If your app itself prints stuff to stdout/stderr, it is likely to be 
>> interleaved with the output from the spying thread.
>> Thread execution order and time slicing is non-deterministic and nothing 
>> synchronizes writing to stdout/stderr
>> to enforce ordering.
>> -- 
>> MK
>>
>> http://github.com/michaelklishin
>> http://twitter.com/michaelklishin
>>  
>> -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@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+u...@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+u...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
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/groups/opt_out.




Re: What causes the text that I print to the terminal to become mangled garbage?

2013-03-13 Thread larry google groups

Thanks all. I don't think this can be just a concurrency issue or I would 
also see it when I'm not using Timbre. If I call pprint from multiple 
threads I don't get this kind of interleaving of individual characters. Nor 
do I normally get this interleaving when just using Timbre. But somehow the 
combination of thread-measuring functions and Timbre set off some 
fireworks. 

Maybe I'll dig into this when I have more time. For now I've switched to 
simple println (rather than Timbre) statements for the thread-measuring 
stuff. 

 



On Wednesday, March 13, 2013 4:02:59 AM UTC-4, Marko Topolnik wrote:
>
> There *is* mutual exclusion on all Java output streams (as well as input 
> streams) so at least individual prints should be atomic. Not that it will 
> solve this, but still, this kind of granularity of interleaving is unusual. 
> I have never seen it.
>
> On Wednesday, March 13, 2013 4:27:00 AM UTC+1, Michael Klishin wrote:
>>
>> 2013/3/13 larry google groups 
>>
>>> At least some of this mangled text is coming from this function, which 
>>> is called at startup and then runs in its own thread
>>
>>
>> If your app itself prints stuff to stdout/stderr, it is likely to be 
>> interleaved with the output from the spying thread.
>> Thread execution order and time slicing is non-deterministic and nothing 
>> synchronizes writing to stdout/stderr
>> to enforce ordering.
>> -- 
>> MK
>>
>> http://github.com/michaelklishin
>> http://twitter.com/michaelklishin
>>  
>

-- 
-- 
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/groups/opt_out.




Re: What causes the text that I print to the terminal to become mangled garbage?

2013-03-13 Thread Marko Topolnik
There *is* mutual exclusion on all Java output streams (as well as input 
streams) so at least individual prints should be atomic. Not that it will 
solve this, but still, this kind of granularity of interleaving is unusual. 
I have never seen it.

On Wednesday, March 13, 2013 4:27:00 AM UTC+1, Michael Klishin wrote:
>
> 2013/3/13 larry google groups >
>
>> At least some of this mangled text is coming from this function, which is 
>> called at startup and then runs in its own thread
>
>
> If your app itself prints stuff to stdout/stderr, it is likely to be 
> interleaved with the output from the spying thread.
> Thread execution order and time slicing is non-deterministic and nothing 
> synchronizes writing to stdout/stderr
> to enforce ordering.
> -- 
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>  

-- 
-- 
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/groups/opt_out.




Re: What causes the text that I print to the terminal to become mangled garbage?

2013-03-12 Thread Jason Lewis
tl;dr concurrency is hard

Jason Lewis

Email  jasonlewi...@gmail.com

Twitter@canweriotnow 

Blog   http://decomplecting.org

About http://about.me/jason.lewis


On Tue, Mar 12, 2013 at 11:27 PM, Michael Klishin <
michael.s.klis...@gmail.com> wrote:

> 2013/3/13 larry google groups 
>
>> At least some of this mangled text is coming from this function, which is
>> called at startup and then runs in its own thread
>
>
> If your app itself prints stuff to stdout/stderr, it is likely to be
> interleaved with the output from the spying thread.
> Thread execution order and time slicing is non-deterministic and nothing
> synchronizes writing to stdout/stderr
> to enforce ordering.
> --
> MK
>
> http://github.com/michaelklishin
> http://twitter.com/michaelklishin
>
> --
> --
> 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/groups/opt_out.
>
>
>

-- 
-- 
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/groups/opt_out.




What causes the text that I print to the terminal to become mangled garbage?

2013-03-12 Thread larry google groups
I saw some functions here that measure CPU and thread usage: 

http://lifeisagraph.com/2011/04/24/debugging-clojure.html

That looked good, so I imported them into my app. I've done this before and 
not had a problem with it. 

For logging, I like to use the Timbre library: 

https://github.com/ptaoussanis/timbre

And then I thought I should call the thread-measuring function and hand its 
return value to timbre. And suddenly the info that I'm logging to the 
terminal became a mangled mess of strangely intermingled text. Can anyone 
suggest why this is happening? 

((applyapply
 str
 " at the start of  persistrst-sessi
on -data-to-datab"aseTlh eetaete-uros"iogns
,   eour c pu alnd thoreado usagke losoks l liikeke  this:t "his
 : ""
< option value='music'>Music"(debug/thread-top))
(debug/thread-top)
  )
[" at the[ start o"f  ade"lAolulr ki ndcsp "]s]ta
rt of  peu2013-Mar-12 23:03:21 -0400 MacBook-Pro.local DEBUG 
[kiosks-clojure.core] - in get-options-for-select-box:  ["Dance" "Theater" 
"Music" "\
All kinds"]
r sainstd- thsreesasdi ouns-adgaet al-o"to2ok0-s1d 3l-iMkaer a-tt1ah2ib 
sa2:s3 e:[,03 31o:u42412 7-7r00 4 c \"pLua wDarenesdnt crteohs\
yr-JeMaaavcdaB ouVosMka\"ge  2l2o o#k<-TPhrroe.aldo s clailk eD EtBhUiGs :[ 
k[i3o1s4k4Ts2h-7rce7la0od0j[uDrees.tcrooryeJ]a"va
VM,05 ,\"maiDne]s>t]ro[4y7J"a3i1vna6V0 0Mg0\"e t\"- 2o2p t#id]a[n4c6e0'21>0D0a0n c\"e1"1\" 19 
# ]\
T[h3r0e8a9d4[0T0h0r e\"ad-T1h1r,ead-12\" 20 #][51,3m4a2i7n0]0>0] [3\"0894000 \"Thread-12\""][\
1340 \"hread-13,5,maiTnh]r>e]a[96 d\"-13q\"tp5 2211 
8#8<9pT0thi0or5ne-a1 dv1a 
 lTuSehe=rl'teehaceadtt[oerTr'h>rTheeaadte-r1<3/,op5\
t,imona>i"n]>
]  [96\"0 \"q t1p15 2#1<8T8h9r0e0a5d- 1T1h rSeealde[cqtotrp052\"18 
81910 0#5<-T1h1r Seealde Tchtroera0d,[5q,tpm5a2i1n8]8>9]0[0854-9101\
 0S0e l\"ectqort0p,55,main]>][849000 \"qtp52121889080859-01035 -A1c3ce 
pAtcocre0pt oSer0l ecSteClehcatnCnehalnConnenleCoctnnore@c0t".M\"usic <1/3o pt# ih" 
r#ehttp://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/groups/opt_out.