Announcement

Collapse
No announcement yet.

PowerTree - ptFF locks up in multiuser mode

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Brent Boshart
    replied
    It would be great if there was a private forum for PowerTree where only registered users could access to discuss issues with code examples. Also I'm ready to pay for a third party DLL for some functions to make it easier (quicker) to use (ie more index management, deleteing records etc.)

    ------------------

    Leave a comment:


  • Ronald-Weber
    Guest replied
    I think I may have found out what my problem was. Below is the sequence I was executing in my code:

    1) Open data file
    2) ptINIT
    3) ptFF
    4) Update data file
    5) ptCLOSE
    6) Close data file
    7) Wait 100 milliseconds and goto 1)

    I changed the code sequence so it executes as:

    1) ptINIT
    2) Open data file
    3) ptFF
    4) Update data file
    5) Wait 100 milliseconds and goto 3)
    6) Close data file
    7) ptCLOSE

    Since I've done the change it doesn't lock up nearly as quick. My application also will not be updating records every 100 milliseconds so I think PowerTree will be a good solution for the VB application I'm creating. I hope that I will be able to eventually port the whole application to PowerBasic but I don't know enough about windows programming yet to do so.

    I figured this out by looking through your sample PowerTree code. Please let me know if I can do anything to completely eliminate the lock up potential.

    Thanks, Ron Weber


    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    Originally posted by Ronald-Weber:
    P.S. It appears that you have special rules about posting PowerTree code on this site. I was unaware of that and hope I didn't break any of them. Where can I find a listing of what I can and cannot post concerning PowerTree or any other product you sell?
    The license for PowerTREE prohibits disclosure or reproduction of the documentation and software in any form, etc (see the license text for more information). Other than that, there are no problems!

    The reason is simple, and this license condition is often applied to libraries that ship in DLL format - if the function declarations for the DLL were made public, it opens the door to... um... un-licensed usage and all that goes with it.

    We (PB) respect this with other peoples products too - for example, when programmers translate header files for a commercial DLL to PowerBASIC, unless they have the DLL authors permission, we will not permit the tranlated headers to be posted to our site.



    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Fred Oxenby
    replied
    Gee, you really got a bunch of 'shared' advice here.
    Sorry that I was not updating my browser before I
    posted my reply....


    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Leave a comment:


  • Fred Oxenby
    replied
    Originally posted by Ronald-Weber:
    Jim,
    I have my data file opened as:
    Open txtDatabaseName.Text + "DataCenter.DB" For Random As hFile Len = Len(rec)
    I can't even understand how you can open same file from two computers in exclusive mode.
    You should use Open ....For Random Access Read Write Shared as ..... if datafile is open all the time.
    But on the other hand, if you do
    1) FindFirstKey
    2) Open datafile
    3) Update Record
    4) Close datafile
    you have to introduce some retry-code when opening datafile,
    as it will be locked for other users during update.
    '----
    Your reply to Jim indicate that you are not opening your
    datafile in shared mode.
    Does 'OPEN' not give you an Error-code?



    ------------------
    Fred
    mailto:[email protected][email protected]</A>
    http://www.oxenby.se

    Leave a comment:


  • Ronald-Weber
    Guest replied
    Lance,

    I don't think it's PowerTree either. All I know is that the program locks when the ptFF command is issued and that it doesn't lock up when running on Windows 95, only 98. It wouldn't surprise me if VB's massive overhead had something to do with it. I'll email you the files tommorrow in a zip file.

    Thanks for responding, Ron

    P.S. It appears that you have special rules about posting PowerTree code on this site. I was unaware of that and hope I didn't break any of them. Where can I find a listing of what I can and cannot post concerning PowerTree or any other product you sell?

    ------------------

    Leave a comment:


  • Gary Stout
    replied
    Ron,
    I just took a look at the OPEN statement for VB6 and its really
    no different that PB. I think if you add SHARED and READ WRITE
    to your OPEN statement, your problem will go away.
    Example : OPEN Filename$ FOR RANDOM ACCESS READ WRITE SHARED as #1

    I haven't had any problems in a network situation with PB,VB or
    PowerTree.

    Hope this helps,
    Gary Stout


    ------------------

    Leave a comment:


  • Lance Edmonds
    replied
    The problem is very unlikely to be be PowerTREE itself, as there are *many* people using this in multi-user mode with no problems. VB, on the other hand, is another matter and I'll do my best to help you with this (although I'm not a VB programmer, I do have access to VB6 for test purposes).

    Problems of this type are not practical to deal with in this forum, without breaking the terms of the PowerTREE licence, please email your code to tech support and we'll see what we can do to help.

    Thanks, and thanks to Jim for his help so far.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Ronald-Weber
    Guest replied
    I hope to hear from others out here who may have experienced similar problems using VB 6.0.

    Thanks, Ron Weber

    ------------------

    Leave a comment:


  • Jim Huguley
    replied
    Ron..

    I have Win98 SE on one, Win95 on another and NT4.0 on another. I don't have the problem, but then I'm using PB not VB.

    When I have time, I will try to do a VB version to see if I have problems. If I succeed, I will email the code to Lance if he agrees and ask him to forward to you. In accordance with not disclosing code re: PTree.....




    ------------------
    Jim..
    [email protected]

    Leave a comment:


  • Ronald-Weber
    Guest replied
    Jim,

    Here's something interesting. I have three computers on my network. Two have Windows 98 and the other is Windows 95. I can't get PowerTree to lockup on the Windows 95 computer. Maybe this will help the developers at PowerBasic track down the problem.

    Thanks, Ron

    ------------------

    Leave a comment:


  • Jim Huguley
    replied
    Ron..

    I have never used PTree in a VB multiuser environment although I do have some code that I used in singleuser mode. I just looked
    at the code and noticed that for the LookUp string. I declared as
    follows..
    Code:
     Dim sLookUp as String
     'in my call to FF
     lngRet = ptFF(ByVal sLookUp, KeyBlock)
     'Note the ByVal. I seem to recall in the help files
     'something about this but don't remember where.
     'I also note that I used ByVal with all of the
     'Strings to all of the Ptree calls. This was only in 
     'my VB code. Memory seems to recall that this was
     'required on variable length strings and not fixed
     'but I'm not certain. I will try and find it and let you
     'know
    Regarding your question. ptFF of course does not have a relationship to your random file while processing but if you don't open your random file SHARED. You will not be able to access it from multiple opens when you do try to access it..


    ------------------
    Jim..
    [email protected]

    Leave a comment:


  • Ronald-Weber
    Guest replied
    Jim,

    Here's my test code so far:

    Cls
    Print "cmdPutRecord_Click Before ptFF"
    frmCreate.Refresh
    ptFF combo, KeyBlock
    If KeyBlock.ErrType <> 0 Then MsgBox "cmdPutRecord_Click KeyBlock.ErrType =" + Str(KeyBlock.ErrType)

    When the two programs use the ptFF at the same time one will lock up and show the "cmdPutRecord_Click Before ptFF" message and sit there until I hit CTRL-ALT-DEL. Your routine won't work because it's stuck in the ptFF function. To answer your question: Yes I am using error trapping statements.

    Thanks, Ron


    ------------------

    Leave a comment:


  • Ronald-Weber
    Guest replied
    Jim,

    I have my data file opened as:

    Open txtDatabaseName.Text + "DataCenter.DB" For Random As hFile Len = Len(rec)

    Does the data file even come into play while the ptFF function is executing. I thought it just opened and searched the .PTX and returned a record number. I'll try setting it up as you did and see what happens.

    I put the following message command right after the ptFF function and it never executes:

    ptFF combo, KeyBlock
    If KeyBlock.ErrType <> 0 Then MsgBox "cmdPutRecord_Click KeyBlock.ErrType =" + Str(KeyBlock.ErrType)

    The ptFF function seems to be caught in an infinite loop.

    I am running all this code from VB. I wonder if VB is screwing up it's communications link to the PowerTree DLL.

    Thanks, Ron


    ------------------

    Leave a comment:


  • Jim Huguley
    replied
    Ron..

    Your last post was made while I was responding to your previous one. The snippet that I posted just "hammers" on the FF call
    until it receives a 0 error that is found it.. an error code that it is not found or a Lock Error where is continues to
    attempt for 100 times. I have found in my case that 100 retries is appropriate assuming the record is locked by another process.
    I have had success with this method. My best recollection is that this was from some code that Dave Navarro posted or sent me.

    If you have not done so, again, I would suggest inserting #DEBUG ERROR ON and some ON ERROR GOTO's to trap the error if possible.




    ------------------
    Jim..
    [email protected]

    Leave a comment:


  • Jim Huguley
    replied
    Ron..

    Are you checking the Err Code both for the PTree function and a possible error code on the Random file ?

    I have as many as 15 programs reading and writing to the same datafile across a network. I open all of the random files as
    Code:
    OPEN "Day.dat" FOR RANDOM SHARED AS myNewFile LEN = LEN(curRec)
    I set MultiUser as you do. KeyBlock.MultiUser = 1 which tells the engine that you are in multiusermode and will return the appropriate error messages such as XX for "a record-locking operating failed in the index".. etc...




    ------------------
    Jim..
    [email protected]

    Leave a comment:


  • Ronald-Weber
    Guest replied
    Jim,

    I didn't completly respond to your advise. When the two programs use the ptFF at the same time one of them locks within the ptFF function. I'm unable to check this error and take corrective action. I'll try your code anyway and let you know how it goes.

    Thanks, Ron

    ------------------

    Leave a comment:


  • Ronald-Weber
    Guest replied
    Jim,

    I'm using similar code. The problem is when one program is executing the ptFF function and the other starts executing its own ptFF function. I'm assuming that I don't have to worry about locking the .PTX file because I set KeyBlock.MultiUser = 1. I do realize that the DATA file has to be locked by my code. Let me know if I'm missing something here.

    Thanks, Ron

    ------------------

    Leave a comment:


  • Jim Huguley
    replied
    Ron..

    In PTree you have to manage locking, etc.. yourself. I use something similar to the below snippet.
    This makes 100 attempts to process the ptFF unless a critical error is encountered. In the help file furnished with PTree
    listed under "Getting Started with PowerTree for Windows" near the bottom under "Multi-user Programming" you will find an
    example of how to lock and unlock a record for adding a record.
    Relating to speed. I call this function approximately 50 times a
    second and have never had it "timeout". Since we are prohibited from posting source code regarding PTree. I think you can read between the lines and understand the below.

    Code:
        lngTimeOut = 100
    
        DO WHILE lngTimeOut
            MAKE CALL TO ptFF 
            SELECT CASE ErrT
            CASE 0
                GET FileNum, RN, Rec
                IF TRIM$(Rec.Sym) = sSymbol THEN
                    pbRetrieve = %True
                END IF
                EXIT DO
            CASE -1, -2, -3, -4
                'Critical Errors
                EXIT DO
            CASE 70
                DECR lngTimeOut
                IF lngTimeOut < 1 THEN
                  EXIT DO
                END IF
            CASE ELSE
              EXIT DO
            END SELECT
        LOOP
        If ISTRUE pbRetrieve THEN
            'Found It.. etc.. 
        End If

    ------------------
    Jim..
    [email protected]

    Leave a comment:


  • Ronald-Weber
    Guest started a topic PowerTree - ptFF locks up in multiuser mode

    PowerTree - ptFF locks up in multiuser mode

    I modified CREATE.BAS to see if PowerTree will work as a solution to a VB program I'm developing.

    The program runs on two different computers that are networked together. One computer searches for a key using ptFF and then changes the contents of a field in that record. This process occurs every 100 milliseconds.

    The other computer runs a copy of the same program. I know this sounds stupid but I'm trying to see how well the PowerTree functions handle multiuser mode.

    Within a second or two one of the programs locks up while both are executing the ptFF function. I know it's the ptFF function because the program chunks away just fine if one of the programs has their ptFF bipassed.

    Has anyone had this problem? If so does anyone have a solution?

    I'm currently using an Access database and it doesn't locked up when I perform the same test but it's bulky and slow. I need a simple solution that handles file locking as good as Access seems too but is more efficient like PowerTree.

    Thanks, Ron Weber
Working...
X
😀
🥰
🤢
😎
😡
👍
👎