Something weird just happened with RHMiner... after 54 minutes it said:
end of dev mode...
Thank you, you an awesome person...
For a moment there I thought my laptop found a block ?
Maybe it did or maybe it didn't and it was just time related ? At that very time I was starting up second laptop... so many it wasn't fast enough to send the block to the blockchain maybe it was not accepted cause there was already a new one.. not sure... in the log it said nothing.
I did see some access violation higher up in log read of address 20 or so...
Anybody know if devmode is turned off automatically after 54 minutes or is there another trigger ?! hmmm...
WOW !!!!
Perhaps my toshiba laptop did find a block but pascalcoin issued a warning:
"Cannot AddNewBlockChain due blocking lock operations node"
This was two minutes after this message of rhminer came about... assuming that time display is actually wall clock time and not time since miner started hmmmm.
Perhaps there is a bug in pascal coin preventing new found blocks from being added properly...
Not sure what rhminer or pascalcoin would normally display if a block was found and about to be added ?
(I am going to dive into pascalcoin source code to see where this error message happens).
function TNode.AddNewBlockChain(SenderConnection: TNetConnection; NewBlockOperations: TPCOperationsComp;
var newBlockAccount: TBlockAccount; var errors: AnsiString): Boolean;
in TNode.pas
Not sure when this function is called.... maybe when new block is found ? maybe not ?
If Not TPCThread.TryProtectEnterCriticalSection(Self,2000,FLockNodeOperations) then begin
If NewBlockOperations.OperationBlock.block<>Bank.BlocksCount then exit;
s := 'Cannot AddNewBlockChain due blocking lock operations node';
TLog.NewLog(lterror,Classname,s);
if TThread.CurrentThread.ThreadID=MainThreadID then raise Exception.Create(s) else exit;
end;
My best guess for now what happened might be the following:
The earlier access violation might have occured during such a critical section, then the critical section was not leaved correctly, leading to this lock still being locked.
If true this could mean that pascalcoin is seriously bugged and has to be restarted to correct this lock, otherwise found blocks will never be added properly.
So this could be a very serious bug if true.
Kinda doubt this is true... then again this locking function might be cause:
class function TPCThread.TryProtectEnterCriticalSection(const Sender: TObject;
MaxWaitMilliseconds: Cardinal; var Lock: TPCCriticalSection): Boolean;
Var tc : TTickCount;
{$IFDEF HIGHLOG}
tc2,tc3,lockStartedTimestamp : TTickCount;
lockCurrThread : TThreadID;
lockWatingForCounter : Cardinal;
s : String;
{$ENDIF}
begin
tc := TPlatform.GetTickCount;
if MaxWaitMilliseconds>60000 then MaxWaitMilliseconds := 60000;
{$IFDEF HIGHLOG}
lockWatingForCounter := Lock.WaitingForCounter;
lockStartedTimestamp := Lock.StartedTickCount;
lockCurrThread := Lock.CurrentThread;
{$ENDIF}
Repeat
Result := Lock.TryEnter;
if Not Result then sleep(1);
Until (Result) Or (TPlatform.GetElapsedMilliseconds(tc)>MaxWaitMilliseconds);
{$IFDEF HIGHLOG}
if Not Result then begin
tc2 := TPlatform.GetTickCount;
if lockStartedTimestamp=0 then lockStartedTimestamp := Lock.StartedTickCount;
if lockStartedTimestamp=0 then tc3 := 0
else tc3 := tc2-lockStartedTimestamp;
s := Format('Cannot Protect a critical section %s %s class %s after %d milis locked by %s waiting %d-%d elapsed milis: %d',
[IntToHex(PtrInt(Lock),8),Lock.Name,
Sender.ClassName,tc2-tc,
IntToHex(lockCurrThread,8)+'-'+IntToHex(Lock.CurrentThread,8),
lockWatingForCounter,Lock.WaitingForCounter,
tc3
]);
TLog.NewLog(ltdebug,Classname,s);
end;
{$ENDIF}
end;
Then again... perhaps same lock/critical section is used somewhere else and other pieces of code would have to be checked.
I am kinda against the "fault tolerant design of pascalcoin" it hides serious issues like this.
It might be better to let pascalcoin crash, so users can restart it or simply fix these issues.
Now these issues might be unreported/unnoticed for a long time... leading to very unfair mining if true.
One possible solution/remedy is to remove this fault tolerant design and/or implement a pascalcoin crash detection, and on crash restart the pascalcoin client, this might be a better/safer option.
Will have to look into this tomorrow
(Re-typing this bitcoin talk seemed to log me out hmm):
Secondary solution could be two run two pascalcoins, either on different systems, or in different folders/ports, code would need to be adjusted for the later.
First pascalcoin system would be mined on, then after some time, miners switch to second pascalcoin system.
Then first pascalcoin system is shutdown... while mining continues on second pascalcoin system.
Then first pascalcoin system is restarted/reloaded safebox and such.
Then miners switch to first one again. Then second one is restarted and so forth.
So to always have a good as possible running pascalcoin... not sure if this would actually help and fix the problem whatever it might be causing this lock to fail and other serious access violations.
Best solution would simply be to fix the damn problems in the first place !
Also perhaps collecting/uploading these logs automatically may also help. Bad situation this... loosing a bit of faith in this... crashing might be better to make people realise this software has some serious issues that need to be fixed... perhaps it will lead to more people actually trying to debug this code... instead of praying and hoping for the best...
Not sure if this software can recover at all from locking issues... probably not if a thread keeps the lock or something like that...
This is my second complaint with this software... Would like it to have only 1 or a max of 2 threads... so that it's less race condition prone and easier to debug.
How for main GUI/VCL and 1 for pascal coin engine...
May have to submit a pip for this... doubt it will be accepted but who knows.
Would require rework of TCP handling and some other stuff...
But where there is a will... there is a way...
Perhaps the lock bug was caused when I closed the laptop and windows logged out...
Anyway I am going to halt mining cause I have lost faith in it because of all these bugs... can't be sure it's actually working correctly.
Could just be a waste of electricity at this point.