-
-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix message sending of tuples sent through interfaces #1614
Conversation
999be90
to
13ee56f
Compare
@Praetonus how are the 2 changes related? |
The fix relates to how the tracing is generated. |
ceba3ca
to
c3b2d7a
Compare
The compiler test suite seems to crash when running the TraceObjectDynamic test on AppVeyor. There isn't any log, would anyone on Windows be able to run the test and see if there is more information? |
I'll take a look. |
It's crashing for me in I suspect there's a memory leak somewhere, since VS2015 fills up my disk and crashes when trying to create a dump file :-) I'm not yet very familiar with the pony runtime, so it will take me a while to try to figure out what all the threads are doing. |
c3b2d7a
to
a743901
Compare
@kulibali That's strange, I don't really see what could cause a memory leak in these tests, and why it would only occur on Windows. Could you try running the tests with a memory profiler, to see where all that memory is allocated? |
I think I know what's going on. The memory allocated with I can see three different ways of fixing this problem
Anybody have any thoughts on that? |
@Praetonus I might not be understanding the runtime correctly, but wouldn't it be possible to free all memory allocated by |
@dipinhora That's roughly the same thing as my third suggestion, except that I was thinking about freeing memory before joining. This is because most of the allocation bookkeeping data is thread local and destroyed at thread exit, and setting up a global data structure to free everything from one thread is equivalent to each thread freeing the memory it allocated. I'm currently doing some tests and it seems that 3. is the best alternative. |
@Praetonus Makes sense. Thanks for the explanation. |
It turns out it's not exactly equivalent. The memory cannot be returned to the OS before the thread joining, because some things containing shared memory (e.g. the message queues) are accessed after joining all threads. We'll have to free the memory in the main thread after joining. |
I've made a PR (#1621) which I think should solve the problem. In the end I took a completely different approach and added the ability for runtime threads to push their free memory to other threads when they terminate. |
a743901
to
d27a46f
Compare
I've rebased on latest master to pick up the changes merged from #1621. |
Not sure what's wrong with the windows CI. |
|
@Praetonus There's two possible fixes to this:
|
My intent with #1621 was only to make memory managed by the pool allocator available to future threads. Returning memory to the OS is tricky because memory in free lists can move between threads. Your second solution seems interesting but I think it would require some work to implement. However, I'm not sure it will be necessary. With the change in #1621, threads should reuse blocks allocated by previous threads and there shouldn't be any virtual allocation after the first run of the runtime. There probably is a bug in the implementation of #1621. I'll look into it. |
@Praetonus Ah, I see. I missed that bit as I was focusing more on the freeing of memory during the It seems after #1621, I'm not sure of the solution, but this might be the bug preventing reuse of blocks allocated by previous threads. |
This commit changes how the Windows memory allocation/commitment is done by switching from committing all memory immediately to only committing memory dynamically as it gets allocated. This resolves the Windows errors that PR ponylang#1614 and PR ponylang#1629 have been encountering related to `ponyint_virt_alloc` and `The paging file is too small for this operation to complete.`
4ccafba
to
362d1d0
Compare
97b1943
to
21d37aa
Compare
I suspect there is a data race in @dipinhora |
545416b
to
52cb30e
Compare
@Praetonus Thanks for the clarification. I was confused because |
I think I found the problem. I'll open another PR with the fix. |
52cb30e
to
142c6a0
Compare
I've pushed the fix here to ensure that it is correct. If it is, I'll open the other PR. |
The tests pass on Windows, I've cancelled the Linux and OSX builds to avoid overloading Travis since it has been quite slow lately. |
This change fixes a case overlooked in fa8f7ad which occurred when sending a tuple containing a boxed type. This change also adds tests for code generation of GC tracing.
142c6a0
to
b4b3950
Compare
I've rebased on latest master after the merge of #1677. This should be good to merge if CI passes. |
This change fixes a case overlooked in fa8f7ad which occurred when sending a tuple containing a boxed type.
This change also adds tests for code generation of GC tracing.
PS: No changelog entry since this is covered by the one from fa8f7ad.