<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div>Hi</div><div><br></div><div>ABOUT</div><div>======<br></div><div>Please be informed that we encountered a issue with slonik parser when submitting a script with more than 9990 to 10000 commands.</div><div><br></div><div>I mean</div><div><br></div><div>/path/to/slonilk << EOF</div><div># include <preamble.sk>;</div><div>command 1;</div><div>command 2;</div><div>....</div><div>command 9997;</div><div><br></div><div>command is something like echo, set add sequence (....), set add table (....) and so on.<br></div><div><br></div><div>slonik crash with a memory error.</div><div><br></div><div>EXAMPLE FOR SLONIK CRASH<br></div><div>=========================<br></div><div>As a example from Slony sources - once the sources have been compiled -</div><div><br></div><div>Generate a stupid script<br></div><div>echo "include
<preamble.sk>;" > test.slonik<br>seq 1 10000 | xargs -i echo "echo '{}';" >> test.slonik</div><div><br></div><div>Submit the script to slonik<br>cat test.slonik | src/slonik/slonik</div><div><stdin>:9995: ERROR: memory exhausted at or near ;<br></div><div><br></div><div>We've got more than 20000 objects (tables + sequences) to replicate.</div><div><br></div><div>FIXING ISSUE FOR THE PARSER LIMITATION/WORKAROUND</div><div>==================================================<br></div><div>While investigating, I found that the problem came from the default value for YYMAXDEPTH in src/slonik/parser.c</div><div>----------<br></div><div>/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only<br> if the built-in stack extension method is used).<br><br> Do not make this value too large; the results are undefined if<br> YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)<br>
evaluated with infinite-precision integer arithmetic. */<br><br>#ifndef YYMAXDEPTH<br># define YYMAXDEPTH 10000<br>#endif<br></div><div>-----<br></div><div><br></div><div>Taking into account the notice in the file, I came to the conclusoion that 10000 is a arbitrary value. We decided to put a a value like 100000 instead on a Linux x86_64 and it works</div><div><br></div><div>Since I do not use slony_logshipping I did not investigate on it.</div><div><br></div><div>The first workaround is to split the script in several scripts but it is not a pleasant workaround.</div><div><br></div><div>We've tested a value like 100000 for YYMAXDEPTH and we did not have any problem.<br></div><div><br></div><div>At Office we work with EnterpriseDB and ask EnterpriseDB for fixing the required value for Slony 1.2.22<br></div><div><br></div><div>As costumer, EnterpriseDB was ok to fix this issue.</div><div><br></div><div>I did not investigate for Slony 2.X but
my concern is that the issue may be the same.<br></div><div><br></div><div>I hope this information could help someone.</div><div><br></div><div>Kind regards.</div><div><br></div><div>David.<br></div><div><br></div><div><br></div></div></body></html>