Pages:
Author

Topic: Nxt source code flaw reports - page 38. (Read 113359 times)

hero member
Activity: 798
Merit: 500
January 06, 2014, 06:05:41 PM
smaragda, ricot, vamdor, ImmortAlex, rlh: Please PM your NXT tip account. Thanks for pouring through the code.

FrictionlessCoin send yours too cuz you need a NXT hug.
Post your addresses guys (gals?) I wanna reward your efforts...

ricot : 100K
ImmortAlex :50K
vamdor: 50K
rlh: 50K
smaragda: 50K

Greetings to sunny Greece. Grin

legendary
Activity: 2142
Merit: 1009
Newbie
January 06, 2014, 05:58:42 PM

Hey CfB... ricot helped me put my concerns from my previous post into perspective...

https://bitcointalksearch.org/topic/nxt-source-code-flaw-reports-397183


Would it be more secure for the network if all initial founding accounts were restricted from forging (after funds have been transferred in other accounts of course)?



It changes nothing.
hero member
Activity: 687
Merit: 500
January 06, 2014, 05:52:40 PM
smaragda, ricot, vamdor, ImmortAlex, rlh: Please PM your NXT tip account. Thanks for pouring through the code.

FrictionlessCoin send yours too cuz you need a NXT hug.
Post your addresses guys (gals?) I wanna reward your efforts...

ricot : 100K
ImmortAlex :50K
vamdor: 50K
rlh: 50K
smaragda: 50K

Hey, I am a nice guy too Cheesy
legendary
Activity: 1498
Merit: 1000
January 06, 2014, 05:49:09 PM
smaragda, ricot, vamdor, ImmortAlex, rlh: Please PM your NXT tip account. Thanks for pouring through the code.

FrictionlessCoin send yours too cuz you need a NXT hug.
Post your addresses guys (gals?) I wanna reward your efforts...

ricot : 100K
ImmortAlex :50K
vamdor: 50K
rlh: 50K
smaragda: 50K

That's great klee. I hope you would be NXT billionaire in two years. Don't forget to helicopter me to your private island at that time  Grin  
You will be in my VIP list  Cool Cheesy Tongue
legendary
Activity: 1498
Merit: 1000
January 06, 2014, 05:48:26 PM
Post your addresses guys (gals?) I wanna reward your efforts...

ricot : 100K
ImmortAlex :50K
vamdor: 50K
rlh: 50K
smaragda: 50K


Is this for real?!?   Shocked    TRULY APPRECIATED!   Grin


...address is in my signature...



Check!
sr. member
Activity: 602
Merit: 268
Internet of Value
January 06, 2014, 05:47:43 PM
smaragda, ricot, vamdor, ImmortAlex, rlh: Please PM your NXT tip account. Thanks for pouring through the code.

FrictionlessCoin send yours too cuz you need a NXT hug.
Post your addresses guys (gals?) I wanna reward your efforts...

ricot : 100K
ImmortAlex :50K
vamdor: 50K
rlh: 50K
smaragda: 50K

That's great klee. I hope you would be NXT billionaire in two years. Don't forget to helicopter me to your private island at that time  Grin  
legendary
Activity: 1498
Merit: 1000
January 06, 2014, 05:47:21 PM
smaragda, ricot, vamdor, ImmortAlex, rlh: Please PM your NXT tip account. Thanks for pouring through the code.

FrictionlessCoin send yours too cuz you need a NXT hug.
Post your addresses guys (gals?) I wanna reward your efforts...

ricot : 100K
ImmortAlex :50K
vamdor: 50K
rlh: 50K
smaragda: 50K

What about FrictionlessCoin? Grin
I will pay him in his scamcoin Tongue
legendary
Activity: 2142
Merit: 1009
Newbie
January 06, 2014, 05:38:44 PM
smaragda, ricot, vamdor, ImmortAlex, rlh: Please PM your NXT tip account. Thanks for pouring through the code.

FrictionlessCoin send yours too cuz you need a NXT hug.
Post your addresses guys (gals?) I wanna reward your efforts...

ricot : 100K
ImmortAlex :50K
vamdor: 50K
rlh: 50K
smaragda: 50K

What about FrictionlessCoin? Grin
legendary
Activity: 1498
Merit: 1000
January 06, 2014, 05:31:04 PM
smaragda, ricot, vamdor, ImmortAlex, rlh: Please PM your NXT tip account. Thanks for pouring through the code.

FrictionlessCoin send yours too cuz you need a NXT hug.
Post your addresses guys (gals?) I wanna reward your efforts...

ricot : 100K
ImmortAlex :50K
vamdor: 50K
rlh: 50K
smaragda: 50K
full member
Activity: 168
Merit: 100
IDEX - LIVE Real-time DEX
January 06, 2014, 05:30:03 PM
The fix is to call awaitTermination on the threadpools before call Block.saveBlocks.
This has been fixed since 0.4.9e. Waiting up to 10 s, then shutdownNow.


Guess that's not what is killing 80% of my nodes. heh.
sr. member
Activity: 392
Merit: 250
January 06, 2014, 04:45:12 PM
The fix is to call awaitTermination on the threadpools before call Block.saveBlocks.
This has been fixed since 0.4.9e. Waiting up to 10 s, then shutdownNow.
full member
Activity: 168
Merit: 100
IDEX - LIVE Real-time DEX
January 06, 2014, 04:14:13 PM
A SIGTERM shouldn't corrupt anything?

No idea, I prefer BareMetal OS. I don't like interface with a lot of icons.

SIGTERM is the signal sent by Unix 'kill' command as the standard way to cleanly shutdown a process.

Taking a short look at the code, totally possible that it messes up everything.
Usually, you'd first write to a temporary file, and when it's finished you'd move it in place and therefore overwrite the old one, since that's only one atomic operation...
In case the process ends while writing, you just have a half-written temporary lying around.
This client doesn't do the moving thing, so as soon as you SIGKILL or even SIGTERM it while it's writing, it's in a bad state.

Ok... brushed up on my Java and dove in:

Code:
	@Override
public void destroy() {

scheduledThreadPool.shutdown();
cachedThreadPool.shutdown();

try {

Block.saveBlocks("blocks.nxt");

} catch (Exception e) { }
try {

Transaction.saveTransactions("transactions.nxt");

} catch (Exception e) { }

try {

blockchainChannel.close();

} catch (Exception e) { }

logMessage("Nxt stopped.");

}

}

Since scheduledThreadPool.shutdown() (and cachedThreadPool) doesn't wait for the threads to actually finish before returning, it might create a condition where saveBlocks blocks the threads that are trying to shutdown due to the synchronized on blocks. So it might be possible for destroy() to exit before the thread pools have completely shutdown, which could cause corruption of blocks.nxt if something bad happens in the threads.

The fix is to call awaitTermination on the threadpools before call Block.saveBlocks.
legendary
Activity: 1181
Merit: 1002
January 06, 2014, 03:24:40 PM
hey ricot, thanks a lot for your work - just sent you a beer! cheers!
newbie
Activity: 56
Merit: 0
January 06, 2014, 02:56:08 PM
A SIGTERM shouldn't corrupt anything?

No idea, I prefer BareMetal OS. I don't like interface with a lot of icons.

SIGTERM is the signal sent by Unix 'kill' command as the standard way to cleanly shutdown a process.

Taking a short look at the code, totally possible that it messes up everything.
Usually, you'd first write to a temporary file, and when it's finished you'd move it in place and therefore overwrite the old one, since that's only one atomic operation...
In case the process ends while writing, you just have a half-written temporary lying around.
This client doesn't do the moving thing, so as soon as you SIGKILL or even SIGTERM it while it's writing, it's in a bad state.
legendary
Activity: 2142
Merit: 1009
Newbie
January 06, 2014, 02:52:03 PM
Line 6707:

Code:
counter++;
if (counter >= 255) {

    break;

}

Why is there a counter, so that only 255 transactions get returned? I know that this is the maximum amount of transactions in a block, but there is no reason why I could get more unconfirmed transactions by another peer, isn't it?

This is to limit volume of data sent between nodes.
full member
Activity: 168
Merit: 100
IDEX - LIVE Real-time DEX
January 06, 2014, 02:30:54 PM
A SIGTERM shouldn't corrupt anything?

No idea, I prefer BareMetal OS. I don't like interface with a lot of icons.

SIGTERM is the signal sent by Unix 'kill' command as the standard way to cleanly shutdown a process.
hero member
Activity: 597
Merit: 500
January 06, 2014, 02:03:58 PM
What information transactions.nxt contains?

Blockchain Explorer shows just timestamp, numbers, IDs for a transaction,
but transactions.nxt contain also names and http addresses.
Eg. "warhorse", "http://google.com", "paperwallet", "darkwallet", "cloudwallet", ...


these are attached aliases
newbie
Activity: 50
Merit: 0
January 06, 2014, 02:00:13 PM
Line 6707:

Code:
counter++;
if (counter >= 255) {

    break;

}

Why is there a counter, so that only 255 transactions get returned? I know that this is the maximum amount of transactions in a block, but there is no reason why I could get more unconfirmed transactions by another peer, isn't it?
hero member
Activity: 834
Merit: 524
Nxt NEM
January 06, 2014, 01:17:04 PM
What information transactions.nxt contains?

Blockchain Explorer shows just timestamp, numbers, IDs for a transaction,
but transactions.nxt contain also names and http addresses.
Eg. "warhorse", "http://google.com", "paperwallet", "darkwallet", "cloudwallet", ...




legendary
Activity: 2142
Merit: 1009
Newbie
January 06, 2014, 11:54:50 AM
A SIGTERM shouldn't corrupt anything?

No idea, I prefer BareMetal OS. I don't like interface with a lot of icons.
Pages:
Jump to: