Skip to content
This repository has been archived by the owner on Jul 3, 2018. It is now read-only.

ProdsFile->write fails on iRODS 4.0 #9

Open
isaacsimmons opened this issue Aug 22, 2014 · 6 comments
Open

ProdsFile->write fails on iRODS 4.0 #9

isaacsimmons opened this issue Aug 22, 2014 · 6 comments
Assignees
Labels

Comments

@isaacsimmons
Copy link
Contributor

When trying to write to a new file on an iRODS 4.0.0 server, we are getting an error when parsing the response message from the server.

  • irods-php is from the latest version here
  • Test servers are iRODS 3.3 and iRODS 4.0

When run against the 3.3 server, the file is successfully created.
When run against the 4.0.0 server, a zero-size file is created and following message is printed

PHP Warning:  unpack(): Type N: not enough input, need 4, have 0 in /var/www/html/uploadTest/irods/RODSMessage.class.php on line 76
PHP Stack trace:
PHP   1. {main}() /var/www/html/uploadTest/upload.php:0
PHP   2. ProdsFile->write() /var/www/html/uploadTest/upload.php:19
PHP   3. RODSConn->fileWrite() /var/www/html/uploadTest/irods/ProdsFile.class.php:251
PHP   4. RODSMessage->unpack() /var/www/html/uploadTest/irods/RODSConn.class.php:1136
PHP   5. unpack() /var/www/html/uploadTest/irods/RODSMessage.class.php:76
PHP Fatal error:  Uncaught RODSException: [-15000 SYS_PACK_INSTRUCT_FORMAT_ERR]:     RODSMessage::unpack failed.1! The header length is unexpected: ''

thrown in /var/www/html/uploadTest/irods/RODSMessage.class.php on line 79

Test File:

<?php
require_once 'irods/Prods.inc.php';
$account = new RODSAccount("example.com", 1247, "rods", "rodspass", "tempZone", "demoResc");
$myfile = new ProdsFile($account, '/tempZone/home/rods/foo.txt');
$myfile->open("w+", $account->default_resc); 
$myfile->write("TEST CONTENTS");
$myfile->close();
@michael-conway
Copy link
Contributor

OK, yet another deprecated api...we'll fix like the last one

MC

On Fri, Aug 22, 2014 at 4:20 PM, isaacsimmons [email protected]
wrote:

When trying to write to a new file on an iRODS 4.0.0 server, we are
getting an error when parsing the response message from the server.

  • irods-php is from the latest version here
  • Test servers are iRODS 3.3 and iRODS 4.0

When run against the 3.3 server, the file is successfully created.
When run against the 4.0.0 server, a zero-size file is created and
following message is printed

PHP Warning: unpack(): Type N: not enough input, need 4, have 0 in /var/www/html/uploadTest/irods/RODSMessage.class.php on line 76
PHP Stack trace:
PHP 1. {main}() /var/www/html/uploadTest/upload.php:0
PHP 2. ProdsFile->write() /var/www/html/uploadTest/upload.php:19
PHP 3. RODSConn->fileWrite() /var/www/html/uploadTest/irods/ProdsFile.class.php:251
PHP 4. RODSMessage->unpack() /var/www/html/uploadTest/irods/RODSConn.class.php:1136
PHP 5. unpack() /var/www/html/uploadTest/irods/RODSMessage.class.php:76
PHP Fatal error: Uncaught RODSException: [-15000 SYS_PACK_INSTRUCT_FORMAT_ERR]: RODSMessage::unpack failed.1! The header length is unexpected: ''

thrown in /var/www/html/uploadTest/irods/RODSMessage.class.php on line 79

Test File:

open("w+", $account->default_resc); $myfile->write("TEST CONTENTS"); $myfile->close(); — Reply to this email directly or view it on GitHub https://github.com//issues/9.

@michael-conway michael-conway self-assigned this Sep 3, 2014
@michael-conway
Copy link
Contributor

Different error on 4.0.3

php > require_once 'Prods.inc.php';
php > $account = new RODSAccount("consortium.local", 1247, "test1", "test", "test1", "test1-resc");
php > $myfile = new ProdsFile($account, '/test1/home/test1xx/test.xml');
php > $myfile->open("w+", $account->default_resc);

Warning: Uncaught RODSException: [-24000 SYS_INTERNAL_NULL_INPUT_ERR]: RODSConn::openFileDesc has got an error from the server

  thrown in /Users/mikeconway/Documents/workspace-release/irods-php/prods/src/RODSConn.class.php on line 1015
php > 

will bring up 3.3.1 vm and compare..

@michael-conway
Copy link
Contributor

ok..replicates as reported 3.3.1

 thrown in /Users/mikeconway/Documents/workspace-release/irods-php/prods/src/RODSConn.class.php on line 1015
php > require_once 'Prods.inc.php';
php > $account = new RODSAccount("localhost", 2247, "test1", "test", "test1", "test1-resc");
php > $myfile = new ProdsFile($account, '/test1/home/test1/test.xml');
php > $myfile->open("w+", $account->default_resc); 


Warning: unpack(): Type N: not enough input, need 4, have 0 in /Users/mikeconway/Documents/workspace-release/irods-php/prods/src/RODSMessage.class.php on line 76

Warning: Uncaught RODSException: [-15000 SYS_PACK_INSTRUCT_FORMAT_ERR]: RODSMessage::unpack failed.1! The header length is unexpected: ''

  thrown in /Users/mikeconway/Documents/workspace-release/irods-php/prods/src/RODSMessage.class.php on line 79
php > 
php > 


@michael-conway
Copy link
Contributor

jargon working version packing instructions for file open

5630 [main] DEBUG org.irods.jargon.core.connection.IRODSMidLevelProtocol  - calling irods function with byte array
5630 [main] DEBUG org.irods.jargon.core.connection.IRODSMidLevelProtocol  - calling irods function with:<DataObjInp_PI><objPath>/test1/home/test1/jargon-scratch/IRODSFileOutputStreamTest/testWriteByteArray.csv</objPath>
<createMode>33188</createMode>
<openFlags>2</openFlags>
<offset>0</offset>
<dataSize>0</dataSize>
<numThreads>0</numThreads>
<oprType>0</oprType>
<KeyValPair_PI><ssLen>1</ssLen>
<keyWord>destRescName</keyWord>
<svalue>test1-resc</svalue>
</KeyValPair_PI>
</DataObjInp_PI>

5630 [main] DEBUG org.irods.jargon.core.connection.IRODSMidLevelProtocol  - api number is:601
5630 [main] DEBUG org.irods.jargon.core.connection.AbstractIRODSMidLevelProtocol  - functionID: 601

@michael-conway
Copy link
Contributor

confusing...new 3.3.1 works

php > require_once 'Prods.inc.php';
php > $account = new RODSAccount("irods331.irods.org", 1247, "test1", "test", "test1", "test1-resc");
php > $myfile = new ProdsFile($account, '/test1/home/test1/testaaa.xml');
php >  $myfile->open("w+", $account->default_resc);
php > $myfile->write("TEST CONTENTS");
php > $myfile->close();
php > quit


@michael-conway
Copy link
Contributor

ok..error is on PRODSFile->write() using the deprecated DataObjWriteInp

class RP_dataObjWriteInp extends RODSPacket
{
    public function __construct($dataObjInx = -1, $len = 0)
    {
        $packlets = array("dataObjInx" => $dataObjInx,
            'len' => $len);
        parent::__construct("dataObjWriteInp_PI", $packlets);
    }

}

Jargon is using the OpenedDataObjInp

OpenedDataObjInp openedDataObjInp = OpenedDataObjInp
                .instanceForFileWrite(fd, offset, length);

michael-conway added a commit that referenced this issue Sep 5, 2014
michael-conway added a commit that referenced this issue Sep 5, 2014
michael-conway added a commit that referenced this issue Sep 5, 2014
michael-conway added a commit that referenced this issue Sep 5, 2014
@michael-conway michael-conway mentioned this issue Sep 5, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants