Euphoria
Ticket #736:
With SIMPLE_MALLOC defined we do not get an Out-Of-Space message
-
Reported by
SDPringle
Dec 08, 2011
With SIMPLE_MALLOC defined we do not get an Out-Of-Space message, instead we get a NULL pointer returned, which will cause Eu to crash.
A test in this test file crashes EUPHORIA. It fails in the worst way:
The ex.err crash file reads:
/home/shawn/Documents/development/modified/euphoria/40/tests/../include/std/primes.e:94 in function calc_primes()
A machine-level exception occurred during execution of this statement
approx_limit = 100000000
time_limit_p = 0.1
result_ = <no value>
Details
1. Comment by mattlewis
Dec 08, 2011
I can't reproduce this. I suggest cleaning and building a debug mode, then see where it's failing using a debugger.
2. Comment by DerekParnell
Dec 08, 2011
A little more detail might be nice.
On my system it does not fail. I see line 94 in primes.e as ...
result_ = list_of_primes & repeat(0, growth)
Is this the same on your system?
What are the values of approx_limit, growth, and length(list_of_primes) at the time of the crash?
3. Comment by SDPringle
Dec 08, 2011
That's funny. It dies on both Ubuntu and Windows Vista.
4. Comment by mattlewis
Dec 08, 2011
Well, it runs just fine here on XP and Kubuntu 11.10. Do you have any local changes? My version was built clean from the head of the 4.0 branch, using the 4.0.3 official version of eui as my eubin on each platform.
5. Comment by SDPringle
Dec 08, 2011
Line number 94 agrees with what Derek says
result_ = list_of_primes & repeat(0, growth)
I am using bleeding edge version of the tool-kit. Bugs might take thousands of trials to reproduce to get everything to line up. After what we saw in this bug I found in be_alloc.c, we shouldn't be surprised except it was failing more or less reliably among Vista and Ubuntu.
We should set the make files to call eutest.ex with the -log parameter and always create a report.
6. Comment by DerekParnell
Dec 08, 2011
I was wondering if you can run it directly using eui after putting some debug code into primes.e to display those variables I asked about.
7. Comment by mattlewis
Dec 08, 2011
Yes, I'm running with the "bleeding edge" as you say, but it runs just fine for me.
SDPringle said...
After what we saw in this bug I found in be_alloc.c, we shouldn't be surprised except it was failing more or less reliably among Vista and Ubuntu.
Sorry, I can't make heads or tails of this sentence.
8. Comment by DerekParnell
Dec 08, 2011
matt said...
SDPringle said...
After what we saw in this bug I found in be_alloc.c, we shouldn't be surprised except it was failing more or less reliably among Vista and Ubuntu.
Sorry, I can't make heads or tails of this sentence.
I'm glad you said that Matt, 'cos I couldn't understand it either but thought it was just me.
9. Comment by SDPringle
Dec 08, 2011
There was a bug I found in be_alloc.c. It involved adding to a sequence and the coder had assumed that the base pointer was fixed relative to the pointer to the s1 struct which isn't always the case. Thousands of tests on this code base and the bug wasn't found until I noticed it browsing the source.
It seems that the t_primes.e problem is a "Heisenbug". This is how I lost this bug and found it again:
make clean all
bash configure --debug
Later, this gets stuck looking for eu.lib which doesn't get built with --debug passed to configure. I did a
ln build/eudbg.a build/eu.a
and a
make all test TESTFILE=t_primes.e
This passed 100%. Then I did again:
bash configure
make library
make interpreter
make test TESTFILE=t_primes.e
Then I got the error back. I am going to try a clean build with debugging off.
10. Comment by SDPringle
Dec 08, 2011
I managed to reproduce it with debugging turned on. It was EMalloc returning NULL. EMalloc was and is not supposed to return NULL. We should get a 'Your program has run out of memory' error message.
11. Comment by SDPringle
Dec 08, 2011
Suppose for -DESIMPLE_MALLOC we can write really short E wrapper functions.
12. Comment by DerekParnell
Dec 08, 2011
Ok now I get it. With SIMPLE_MALLOC defined we do not get an Out-Of-Space message, instead we get a NULL pointer returned, which will cause Eu to crash.
13. Comment by SDPringle
Dec 09, 2011
Renaming and pre-pending content to the bug report now that we understand why this happens.
14. Comment by SDPringle
Dec 09, 2011
See: hg:euphoria/rev/b20b21fee2ed
changeset: 5333:b20b21fee2ed branch: 4.0 parent: 5329:57f5cc1a87df user: Shawn Pringle <shawn.pringle@gmail.com> date: Fri Dec 09 14:44:20 2011 -0300 files: source/Makefile.gnu source/be_alloc.c source/be_alloc.h description:
- creates implementations for EMalloc and Erealloc as really thin wrappers to malloc() and realloc() but will close the program with an error message when memory runs out.
- fixes ticket 736