-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
[SWIG][mmlspark] allow allocating more than int max array #2859
[SWIG][mmlspark] allow allocating more than int max array #2859
Conversation
@imatiach-msft Sorry for the inconvenience, but can you please rebase to the latest master to fix CI checks? |
d480025
to
9a83dcb
Compare
@StrikerRUS done! |
Hey @imatiach-msft, Can you please resolve conflicts that appeared after merging #2850? |
9a83dcb
to
1c08358
Compare
@StrikerRUS done! Resolved conflicts, updated PR. |
ping @guolinke @StrikerRUS thanks! |
@imatiach-msft |
@StrikerRUS this is just a slightly modified version of the SWIG file here which we were already using in the previous %array_functions call: |
Hello @imatiach-msft :), If we're going to change that, then can we use an unsigned type like |
Also, SWIG's carrays.i, is NOT memory-allocation safe, which means your whole application can crash just because the OS kills your underlying C process. So my suggestion is since we're changing the Java API anyways, just fix it ourselves. We could throw an exception or even easier, use new (nothrow). Anyone who wishes to handle that case just has to test in Java for the null pointer, all other users who are not concerned with such issues (non-production) can keep working like before. What do you say? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix this issue swig/swig#1755 for users of our SWIG API to avoid irrecoverable crashes in production systems.
You can use new nothrow or wrap the std::bad_alloc exception through SWIG. I guess the second is more elegant but requires more SWIG code:
https://valelab4.ucsf.edu/svn/3rdpartypublic/swig/Doc/Manual/Java.html#Java_exception_handling
@AlbertoEAF "then can we use an unsigned type like size_t" |
@AlbertoEAF "So my suggestion is since we're changing the Java API anyways, just fix it ourselves" Agree that it should be fixed, but can this be part of a separate PR? This issue is much more pressing and I really want to fix it so I can publish a new lightgbm jar for customers with very large data. The additional change would require more integration testing on my side. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@imatiach-msft asked to have such issues fixed in another PR.
Ignoring that, it will change the Java SWIG API, but I think the code looks good.
gently ping @guolinke for the review |
resolves issue #2615 by introducing long versions of SWIG-generated array
ping @chris-smith-zocdoc @guolinke
validated jar in mmlspark