This is a static archive of the previous Open Grid Forum Redmine content management system saved from host redmine.ogf.org file /issues/61 at Fri, 04 Nov 2022 20:54:33 GMT bug #61: incorrect return value of drmaa2_create_jsession() - DRMAAv2 Root Specification - Open Grid Forum

bug #61

incorrect return value of drmaa2_create_jsession()

Added by Daniel Gruber over 9 years ago. Updated over 7 years ago.

Status:closed Start date:02/13/2013
Priority:Urgent Due date:
Assignee:- % Done:

0%

Category:-
Target version:-

Description

GFD-R-P.198

"drmaa2_jsession drmaa2_create_jsession ( const char * session_name , const char * contact );"

The drmaa2_jsession returned has zero functionality (because the session isn't open after the call)
and is error prone and costs each developer further code to get rid of it without creating a
memory leak.

Normal usage:

drmaa2_error error;
drmaa2_jsession js = drmaa2_create_jsession("mysession", NULL);

if (js != NULL) {
/* ok - created a new session -> free session in order to prevent
a memory leak and to prevent further usage of this invalid job
session */
drmaa2_session_free(&js);
} else {
error = drmaa2_lasterror();
}

Since a job session is opened with a string there is no
functionality other than freeing connected to the job session.
Rather a common error would be using this job session to call functions
on it.

It should be a one liner:

drmaa2_error error = drmaa2_create_jsession("mysession", NULL);

History

Updated by Peter Tröger over 9 years ago

  • Project changed from DRMAAv2 C Binding to DRMAAv2 Root Specification

This is a general criticism on the API layout, which therefore belongs to the root specification.

Updated by Peter Tröger over 9 years ago

"The drmaa2_jsession returned has zero functionality (because the session isn't open after the call)".

I don't share this view. Separating creation and opening as functionality makes a lot of sense, since the error model is different. The root spec says clearly the the "createJobSession" result is immediately usable, which therefore is also the case in the C binding.

In other terms, the result of drmaa2_create_jsession() is an open and usable job session, if no error occurred.

Updated by Daniel Gruber over 9 years ago

You are right, this flaw originates from the root specification and could be solved additionally there.

Updated by Daniel Gruber over 9 years ago

Thanks Peter! You're right, I interpreted the "must be usable" in a way that the session is created in the DRM system itself and can be used immediately for opening the session. But when having a closer look - it seems really the case that the session can be used without opening it again. If an error would be returned only it also would make the NULL parameter semantic (which creates a session with a unique name) useless.

I will close the issue.

Updated by Peter Tröger over 9 years ago

Maybe you can suggest some description text improvement to make the intended semantics more obvious.

Updated by Daniel Gruber over 9 years ago

7.1.16 createJobSession / createReservationSession

The method creates and opens a new job / reservation session instance. On successful completion of this method, the necessary initialization for making the session usable MUST be completed...

I would just add the "and opens" in the first sentence.

Updated by Peter Tröger over 9 years ago

  • Status changed from submitted to accepted

Good. We can close the discussion for the moment, and leave this tracker as reference for the later spec change.

Updated by Peter Tröger about 8 years ago

  • Status changed from accepted to final review

The OGF-42 meeting decided to use the text enhancement proposal by Daniel Gruber, as stated above.

Updated by Peter Tröger over 7 years ago

  • Status changed from final review to closed

Fixed in July 2015 errata.

(Other formats not available in this archive.

This is a static archive of the previous Open Grid Forum Redmine content management system saved from host redmine.ogf.org file /issues/61 at Fri, 04 Nov 2022 20:54:33 GMT