isc_cancel_events returns error invalid events id (handle) (code: 335545021) if
event is (no longer) queued
-----------------------------------------------------------------------------------------------------------
Key: CORE-4794
URL: http://tracker.firebirdsql.org/browse/CORE-4794
Project: Firebird Core
Issue Type: Bug
Components: API / Client Library
Affects Versions: 3.0 Beta 1
Reporter: Mark Rotteveel
Related to CORE-4756:
Cancelling an event that is not currently queued will return error 335545021
("invalid events id (handle)"). This is a deviation from the behavior in
Firebird 2.5.4 and earlier which allows this.
Sample code that reproduces this (Jaybird 3/JNA so it is close to the native
API):
/******************/
JnaDatabase db = factory.connect(connectionInfo);
db.attach();
FbClientLibrary lib = db.getClientLibrary();
ISC_STATUS[] statusVector = new ISC_STATUS[20];
SimpleEventHandler eventHandler = new SimpleEventHandler();
final JnaEventHandle eventHandle = new JnaEventHandle("TEST_EVENT_A",
eventHandler, db.getEncoding());
int size = lib.isc_event_block(eventHandle.getEventBuffer(),
eventHandle.getResultBuffer(), (short) 1, eventHandle.getEventNameMemory());
eventHandle.setSize(size);
// Queue event
lib.isc_que_events(statusVector, db.getJnaHandle(),
eventHandle.getJnaEventId(), (short) eventHandle.getSize(),
eventHandle.getEventBuffer().getValue(), eventHandle.getCallback(),
eventHandle.getResultBuffer().getValue());
System.out.printf("Status: %s %s%n", statusVector[0], statusVector[1]);
// Event will notify almost immediately for initial setup.
Thread.sleep(50);
// Cancel (no event queued right now)
lib.isc_cancel_events(statusVector, db.getJnaHandle(),
eventHandle.getJnaEventId());
System.out.printf("Status: %s %s%n", statusVector[0], statusVector[1]);
/******************/
With the 2.5.4 fbclient.dll this prints:
Status: 1 0
Status: 1 0
With 3.0.0.31839:
Status: 1 0
Status: 1 335545021
The asynchronous nature of events makes it hard to guarantee that an event is
still queued when you cancel it. As such cancelling a no longer queued event
should not be considered an error (at most it should be a warning). This is
also what 2.5.4 does (interface.cpp, GDS_CANCEL_EVENTS):
// If the event exists, tell the remote server to cancel it,
// and delete it from the list
Rvnt* event = find_event(port, *id);
if (event) {
send_cancel_event(event);
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel