IronLanguages / IronLanguages/ironpython3

Segmentation fault running ctypes.test_slicing on Mono.

Open
#1,299 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

module-ctypes Mono
Dominant language
C#
Stars
2.8k
Forks
316
Avg merge
1d 9h
Merged PRs (30d)
1

Description

Running the following code Mono (from CPython.ctypes.test_slicing) leads to all sorts of failures (upon exiting the program?):

from ctypes import *
import _ctypes_test
s = b"abcdefghijklmnopqrstuvwxyz"

dll = CDLL(_ctypes_test.__file__)
dll.my_strdup.restype = POINTER(c_char)
dll.my_free.restype = None
res = dll.my_strdup(s)
dll.my_free(res)

Does not occur consistently. Might be some sort of marshaling issue causing a double free?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use CPython.ctypes.test_slicing and the shown Mono ctypes snippet as entry points; begin by reproducing the intermittent failure and checking whether it occurs during exit after my_free. Investigate marshaling and ownership around _ctypes_test.my_strdup and my_free, then verify that the failure no longer occurs consistently and that the relevant slicing test covers the regression.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, python
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.