[ 
https://issues.apache.org/jira/browse/SPARK-12519?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16118123#comment-16118123
 ] 

min shi commented on SPARK-12519:
---------------------------------

this happens to sparkSql dataframe too.
{code:java}
    val df: DataFrame = records.select("somecolumn").distinct()
    val cnt= df.count()
    val Row(cntValue: Integer) = df.head() //causing memory leak when the above 
row count is greater than 1; it had no problem if the cnt is just 1.
{code}

Question: does this bug mean we can just ignore the error?

> "Managed memory leak detected" when using distinct on PySpark DataFrame
> -----------------------------------------------------------------------
>
>                 Key: SPARK-12519
>                 URL: https://issues.apache.org/jira/browse/SPARK-12519
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark
>    Affects Versions: 1.5.2
>         Environment: OS X 10.9.5, Java 1.8.0_66
>            Reporter: Paul Shearer
>
> After running the distinct() method to transform a DataFrame, subsequent 
> actions like count() and show() may report a managed memory leak. Here is a 
> minimal example that reproduces the bug on my machine:
> h1. Script
> {noformat}
> logger = sc._jvm.org.apache.log4j
> logger.LogManager.getLogger("org"). setLevel( logger.Level.WARN )
> logger.LogManager.getLogger("akka").setLevel( logger.Level.WARN )
> import string
> import random
> def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
>     return ''.join(random.choice(chars) for _ in range(size))
> nrow   = 80000
> ncol   = 20
> ndrow  = 40000 # number distinct rows
> tmp = [id_generator() for i in xrange(ndrow*ncol)]
> tmp = [tuple(tmp[ncol*(i % ndrow)+0:ncol*(i % ndrow)+ncol]) for i in 
> xrange(nrow)] 
> dat = sc.parallelize(tmp,1000).toDF()
> dat = dat.distinct() # if this line is commented out, no memory leak will be 
> reported
> # dat = dat.rdd.distinct().toDF() # if this line is used instead of the 
> above, no leak
> ct = dat.count()
> print ct  
> # memory leak warning prints at this point in the code
> dat.show()  
> {noformat}
> h1. Output
> When this script is run in PySpark (with IPython kernel), I get this error:
> {noformat}
> $ pyspark --executor-memory 12G --driver-memory 12G
> Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12) 
> Type "copyright", "credits" or "license" for more information.
> IPython 4.0.0 -- An enhanced Interactive Python.
> ?         -> Introduction and overview of IPython's features.
> %quickref -> Quick reference.
> help      -> Python's own help system.
> object?   -> Details about 'object', use 'object??' for extra details.
> <<<... usual loading info...>>>
> Welcome to
>       ____              __
>      / __/__  ___ _____/ /__
>     _\ \/ _ \/ _ `/ __/  '_/
>    /__ / .__/\_,_/_/ /_/\_\   version 1.5.2
>       /_/
> Using Python version 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015 09:33:12)
> SparkContext available as sc, SQLContext available as sqlContext.
> In [1]: execfile('bugtest.py')
> 40000
> 15/12/24 09:33:14 ERROR Executor: Managed memory leak detected; size = 
> 16777216 bytes, TID = 2202
> +------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
> |    _1|    _2|    _3|    _4|    _5|    _6|    _7|    _8|    _9|   _10|   
> _11|   _12|   _13|   _14|   _15|   _16|   _17|   _18|   _19|   _20|
> +------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
> |83I981|09B1ZK|J5UB1A|BPYI80|7JTIMU|HVPQVY|XS4YM2|6N4YO3|AB9GQZ|92RCHR|1N46EU|THPZFH|5IXNR1|KL4LGD|B0S50O|DZH5QP|FKTHHF|MLOCTD|ZVV5BY|D76KRK|
> |BNLSVC|CYYYMD|W6ZXF6|Z0QXDT|4JPRX6|YSXIBK|WCB6YD|C86MPS|ZRA42Z|8W8GX8|2DW3AA|ZZ1U0O|EVXX3L|683UOL|5M6TOZ|PI4QX8|6V7SOS|THQVVJ|0ULB14|DJ2LP5|
> |IZYG7Q|Q0NCUG|0FSTPN|UVT8Y6|TBAEF6|5CGN50|WNGOSB|NX2Y8R|XWPW7Y|WPTLIV|NPF00K|92YSNO|FP50AU|CW0K3K|8ULT74|SZM6HK|4XPQU9|L109TB|02X1UC|TV8BLZ|
> |S7AWK6|7DQ8JP|YSIHVQ|1NKN5G|UOD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|4GPD0Z|ZQ72K5|EIVYSE|
> |X6MH6R|VM5M86|ZV1H22|Z5V1FX|XRZSGC|L39Q1R|1OT5XB|84NY6I|IXKYXQ|KY2U4G|F13S00|CZRR3E|ZIAVU0|DU2BAB|27KBZ8|XWBB7G|09V69R|LTXJ4U|8GP3EM|P3WVAX|
> |1IPOKL|9EIG2Q|UQJV00|RXJGCK|X20VBH|CZB7SQ|THZ95A|V90YSH|9QTKCW|0RLYJO|WSTNYK|UXZYST|WT8OHL|KE31OO|C0ZKRE|9VSDJF|6Z3JAR|RR0KMB|R3J61U|EPNRZL|
> +------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+------+
> only showing top 20 rows
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to