Skip to content
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

zmq assertion failure with TZMQPoller.Poll #17

Open
toleressea opened this issue Feb 24, 2016 · 4 comments
Open

zmq assertion failure with TZMQPoller.Poll #17

toleressea opened this issue Feb 24, 2016 · 4 comments

Comments

@toleressea
Copy link
Contributor

I receive the following error message when attempting to use TZMQPoller.Poll with the 64-bit ZeroMQ library (3.2.4, in this case):

"Assertion failed: Invalid argument (......\src\zmq.cpp:868)"

The following is an example free pascal program that generates the error (using 64-bit FPC):

program TestZmqPoll;

{$mode objfpc}{$H+}

uses
  Classes,
  zmqapi;

var
  context: TZMQContext;
  socket: TZMQSocket;
  poller: TZMQPoller;
begin
  context := TZMQContext.create;
  socket := context.Socket(stSub);
  socket.bind('tcp://*:50000');
  socket.Subscribe('');
  poller := TZMQPoller.Create(True, context);

  poller.Register(socket, [pePollIn]);
  while True do begin
    poller.poll(500);
  end;
end.

The assertion failure does not occur when using 32-bit FPC and libzmq.

@bvarga
Copy link
Owner

bvarga commented Feb 26, 2016

I've never tried to make it work with a 64bit ZeroMQ lib, :(

@cpicanco
Copy link
Contributor

cpicanco commented Nov 22, 2016

I stumbled in a similar issue. Here are some notes.

On a windows 10, 64 bits machine.

First I have built 32 and 64 versions of libzmq.dll (3.2.5) with vs2015. Pool works great with Lazarus 32 bits (1.6.2, fpc 3.0.0) and libzmq.dll 32 bits. However, it failed with Lazarus 64 bits and libzmq.dll 64 bits (TZMQPoller.poll returning result = -1). I had to change the following lines to make lazarus happy:

zmqapi.pas

procedure TZMQSocket.RegisterMonitor( proc: TZMQMonitorProc; events: TZMQMonitorEvents = cZMQMonitorEventsAll );
var
  PISocket : ^integer;
  {$ifdef UNIX}
  tid: QWord;
  {$else}
    {$ifdef WIN32}
    tid: LongWord;
    {$endif}
    {$ifdef WIN64}
    tid: QWord;
    {$endif}
  {$endif}
begin  

On a Linux Bunsen Labs-Hydrogen (Debian 8), 64 bits machine.

Everything works great with Lazarus 1.6.0 64 bits. Lazarus 32 was not tested. Lazarus 1.6.2 will be tested.

cpicanco added a commit to cpicanco/stimulus_control that referenced this issue Nov 22, 2016
- must compile with Lazarus 32 bits until delphizmq pool 64 bits support
is available. See: bvarga/delphizmq#17
@bvarga
Copy link
Owner

bvarga commented Nov 23, 2016

Any pull requests are welcome, it's a great news that you could make it work on 64bit.

@cpicanco
Copy link
Contributor

cpicanco commented Nov 23, 2016

@bvarga , I did nothing, really! ZMQPool still does not work on Win64 (even though it gets compiled with the corresponding "*.dll"). And on Linux 64, Lazarus 64 bits and compiling the 3.2.5 version from source it always worked without any changes. I am not sure why 🙄 💫

Ps.: Lazarus 1.6.2 64 bits works great as well.

cpicanco added a commit to cpicanco/stimulus_control that referenced this issue Nov 23, 2016
- must compile with Lazarus 32 bits until delphizmq pool 64 bits support
is available. See: bvarga/delphizmq#17
cpicanco added a commit to lacs-ufpa/free-mtrix that referenced this issue Dec 28, 2016
- must compile with Lazarus 32 bits until delphizmq pool 64 bits support
is available. See: bvarga/delphizmq#17
cpicanco added a commit to cpicanco/stimulus_control that referenced this issue Feb 1, 2017
- must compile with Lazarus 32 bits until delphizmq pool 64 bits support
is available. See: bvarga/delphizmq#17
toleressea added a commit to toleressea/delphizmq that referenced this issue Dec 10, 2018
toleressea added a commit to toleressea/delphizmq that referenced this issue Dec 10, 2018
toleressea added a commit to toleressea/delphizmq that referenced this issue Dec 10, 2018
bvarga pushed a commit that referenced this issue Jan 3, 2019
* Correct zmq assertion failure for 64-bit TZMQPoller.Poll

#17

* Resolve FPC 64-bit compilation issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants