ponylang / ponyc

Pony is an open-source, actor-model, capabilities-secure, high performance programming language
http://www.ponylang.io
BSD 2-Clause "Simplified" License
5.71k stars 415 forks source link

Intermittent files/File.writevlarge failure #2059

Open lgbaldoni opened 7 years ago

lgbaldoni commented 7 years ago

Packaging ponyc 0.15.0 for openSUSE, PR https://github.com/ponylang/ponyc/pull/2047 solved most of the previous test problems, but the one in the subject is still lingering.

It occurs sometimes on i586 and consistently on armv7l (both using gcc7, unsure if relevant):

+ sed -e '/test(_TestBroadcast)/d' -i packages/net/_test.pony
+ make -j1 config=release verbose=yes test
[==========] Running 961 tests from 39 test cases.
...
**** FAILED: files/File.writevlarge
Unhandled error!
...
---- 266 tests ran.
---- Passed: 265
**** FAILED: 1 test, listed below:
**** FAILED: files/File.writevlarge
make: *** [Makefile:756: test] Error 255

Is there a way to find out more about this?

SeanTAllen commented 7 years ago

All errors in _TestFileWritevLarge

lines 504, 511 are possible points of error and every usage of as.

lgbaldoni commented 7 years ago

This patch:

Index: ponyc-0.15.0/packages/files/_test.pony
===================================================================
--- ponyc-0.15.0.orig/packages/files/_test.pony
+++ ponyc-0.15.0/packages/files/_test.pony
@@ -507,11 +507,6 @@ class iso _TestFileWritevLarge is UnitTe
       file.dispose()
       let file2 = CreateFile(filepath) as File
       count = 0
-      while count < writev_batch_size do
-        let fileline1 = file2.line()
-        h.assert_eq[String](count.string(), consume fileline1)
-        count = count + 1
-      end
       file2.dispose()
       filepath.remove()
     else

and not running make test in parallel (-j1) seems to fix this and other random segfaults. I'll leave to someone more knowledgeable to determine whether the two things are related.

SeanTAllen commented 7 years ago

the patch seems more like it is removing code that triggers the problem rather than actually fixing the issue so line 511:

        let fileline1 = file2.line()

would appear to be what is throwing the error.

lgbaldoni commented 7 years ago

I do realise that, I was trying to pinpoint the problem among the lines you mentioned. But unfortunately I'm going to need more handholding on this, although I could simply disable the test and call it a day.

jemc commented 7 years ago

It might help debugging to try changing: let fileline1 = file2.line() to: let fileline1 = try file2.line() else "<missing>" end and see the output.

lgbaldoni commented 7 years ago

Done, here's the result:

**** FAILED: files/File.writevlarge
/home/abuild/rpmbuild/BUILD/ponyc-0.15.0+git681.g8b4a3e39/packages/files/_test.pony:512: Assert eq failed.  Expected (1024) == (<missing>)
/home/abuild/rpmbuild/BUILD/ponyc-0.15.0+git681.g8b4a3e39/packages/files/_test.pony:512: Assert eq failed.  Expected (1025) == (<missing>)
/home/abuild/rpmbuild/BUILD/ponyc-0.15.0+git681.g8b4a3e39/packages/files/_test.pony:512: Assert eq failed.  Expected (1026) == (<missing>)
/home/abuild/rpmbuild/BUILD/ponyc-0.15.0+git681.g8b4a3e39/packages/files/_test.pony:512: Assert eq failed.  Expected (1027) == (<missing>)
/home/abuild/rpmbuild/BUILD/ponyc-0.15.0+git681.g8b4a3e39/packages/files/_test.pony:512: Assert eq failed.  Expected (1028) == (<missing>)
/home/abuild/rpmbuild/BUILD/ponyc-0.15.0+git681.g8b4a3e39/packages/files/_test.pony:512: Assert eq failed.  Expected (1029) == (<missing>)
/home/abuild/rpmbuild/BUILD/ponyc-0.15.0+git681.g8b4a3e39/packages/files/_test.pony:512: Assert eq failed.  Expected (1030) == (<missing>)
/home/abuild/rpmbuild/BUILD/ponyc-0.15.0+git681.g8b4a3e39/packages/files/_test.pony:512: Assert eq failed.  Expected (1031) == (<missing>)
/home/abuild/rpmbuild/BUILD/ponyc-0.15.0+git681.g8b4a3e39/packages/files/_test.pony:512: Assert eq failed.  Expected (1032) == (<missing>)
/home/abuild/rpmbuild/BUILD/ponyc-0.15.0+git681.g8b4a3e39/packages/files/_test.pony:512: Assert eq failed.  Expected (1033) == (<missing>)
jemc commented 7 years ago

Okay, this is very interesting - it appears to be uncovering an actual bug on your platform in the mechanism that this test is designed to exercise. File.writev is failing to write lines beyond the IOV_MAX / pony_os_writev_max (1024).