[
https://issues.apache.org/jira/browse/ARROW-7040?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17007222#comment-17007222
]
Anthony Abate commented on ARROW-7040:
--------------------------------------
created a PR for this:
https://github.com/apache/arrow/pull/6122
> [C#] System.Memory Span.CopyTo - Crashes on Net Framework
> -----------------------------------------------------------
>
> Key: ARROW-7040
> URL: https://issues.apache.org/jira/browse/ARROW-7040
> Project: Apache Arrow
> Issue Type: Bug
> Components: C#
> Affects Versions: 0.14.1, 0.15.0
> Reporter: Anthony Abate
> Assignee: Anthony Abate
> Priority: Blocker
> Labels: pull-request-available
> Time Spent: 10m
> Remaining Estimate: 0h
>
> The following code crashes on 8 cores.
> {code:java}
> public async Task StringArrayBuilder_StressTest()
> {
> var wait = new List<Task>();
> for (int i = 0; i < 30; ++i)
> {
> var data = Enumerable.Range(0, 1000).Select(x => $"Item {x +
> 1}").ToArray();
> var t = Task.Run(() =>
> {
> for (int j = 0; j < 10000000; ++j)
> {
> var builder = new StringArray.Builder();
> builder.AppendRange(data);
> }
> });
> wait.Add(t);
> }
> await Task.WhenAll(wait);
> } {code}
>
> It does not happen with the primitive arrays. (ie IntArrayBuilder)
> I suspect it is due to the offset array / and all the copy / resizing going on
>
> Update - it seems that the problem is in the underlying
> *ArrowBuffer.Builder<T>*
> {code:java}
> public async Task ValueBuffer_StressTest()
> {
> var wait = new List<Task>();
> for (int i = 0; i < 30; ++i)
> {
> var data = Enumerable.Range(0, 1000).Select(x => $"Item {x +
> 1}").ToArray();
> var t = Task.Run(() =>
> {
> for (int j = 0; j < 10000000; ++j)
> {
> ArrowBuffer.Builder<byte> ValueBuffer = new
> ArrowBuffer.Builder<byte>();
> foreach (var d in data)
> {
> ValueBuffer.Append(Encoding.UTF8.GetBytes(d));
> }
> }
> });
> wait.Add(t);
> }
> await Task.WhenAll(wait);
> }{code}
>
> Update 2:
> This is due to a confirmed bug in System.Memory - The implications are that
> Span.CopyTo needs to be removed / replaced.
> This is method is used internally by ArrowBuffer so I can't work around this
> easily.
> Solutions
> # Change the code
> ## Remove it out right (including disable span in FlatBuffer)
> ## create a multi target nuget where the offending code has compile blocks
> #If (NETFRAMEWORK) - and disable span in FlatBuffers only for net framework
> build
> # wait for a System.Memory fix?
>
> I suspect option 2 won't happen anytime soon.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)