Skip to content

intermitten segmentation fault #565

Description

@dzhao

Hi, there,
I am trying to use jnaerator.12 + bridj7.0 to parse/wrap a trading client library(Linux 64bit). The library provides 4 main class.
CUstpFtdcTraderApi CUstpFtdcTraderSpi
CUstpFtdcMdUserApi CUstpFtdcMdUserSpi
The first two are for market data and the latter two are for sending trades.
xxxApi is for sending data to server, xxxSpi are callbacks that listens to server responses.

Firstly, CUstpFtdcMdUserApi.SubMarketData will cause jvm to crash. I checked the jnaerated java code. it has sth. like below:
/**
* Original signature : int SubMarketData(char_[], int)

* native declaration : FemasAPI_V1.21_20140806/include/USTPFtdcMduserApi.h:142
/
@virtual(9)
public int SubMarketData(Pointer<Pointer> ppInstrumentID, int nCount); {
return SubMarketData(Pointer.getPeer(ppInstrumentID), nCount);
}
@virtual(9)
protected native int SubMarketData(@ptr long ppInstrumentID, int nCount);
/_

I tried this:
@virtual(9)
public native int SubMarketData(Pointer<Pointer> ppInstrumentID, int nCount);
And it seems to work for 60% of the runs. But still jvm still crashes from time to time. I am pretty sure it's because of this call since I turned out BRIDJ_LOG_CALL and that's where it ends.

Any pointers as to where the problem is? I am scratching my head as this is pretty hard to debug. Other than that, it's a wonderful library.. a life saver for me not having to touch too much c++ code:)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions