Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: max() arg is an empty sequence if there is only 1 filled block #4

Closed
drandreaskrueger opened this issue Feb 26, 2019 · 3 comments

Comments

@drandreaskrueger
Copy link
Owner

when very few transactions, and all fit into 1 block:

Send 200 transactions 
...
block 3 | new #TX 200 / 4000 ms =  50.0 TPS_current | total: #TX  201 /  4.6 s =  43.5 TPS_average (peak  is  43.5 TPS_average)
block 4 | new #TX   0 / 4000 ms =   0.0 TPS_current | total: #TX  201 /  8.0 s =  25.1 TPS_average (peak  is  25.1 TPS_average)
block 5 | new #TX   0 / 4000 ms =   0.0 TPS_current | total: #TX  201 / 11.9 s =  16.8 TPS_average (peak  is  16.8 TPS_average)
block 6 | new #TX   0 / 4000 ms =   0.0 TPS_current | total: #TX  201 / 16.2 s =  12.4 TPS_average (peak  is  12.4 TPS_average)
block 7 | new #TX   0 / 4000 ms =   0.0 TPS_current | total: #TX  201 / 19.8 s =  10.1 TPS_average (peak was  12.4 TPS_average)
block 8 | new #TX   0 / 4000 ms =   0.0 TPS_current | total: #TX  201 / 24.1 s =   8.3 TPS_average (peak was  12.4 TPS_average)
block 9 | new #TX   0 / 4000 ms =   0.0 TPS_current | total: #TX  201 / 28.0 s =   7.2 TPS_average (peak was  12.4 TPS_average)
block 10 | new #TX   0 / 4000 ms =   0.0 TPS_current | total: #TX  201 / 32.0 s =   6.3 TPS_average (peak was  12.4 TPS_average)
...
=============================
= blocksDB_diagramming.py
=============================
...
from block 3 to block 3, with 10 empty blocks afterwards

then there is a problem:

./blocksDB_diagramming.py:422: RuntimeWarning: invalid value encountered in double_scalars
  tps=(txs/duration)

Traceback (most recent call last):
...
    blMin, blMax = min(dfs["blocknumber"])+1, max(dfs["blocknumber"][:lastFilledBlock_index])
ValueError: max() arg is an empty sequence

details:

peak TPS single block:
    blocknumber  TPS_1blk  TPS_3blks  TPS_5blks  TPS_10blks  txcount   size  gasUsed  gasLimit   timestamp  blocktime
2             5       0.0        NaN        NaN         NaN        0    586        0  40000000  1551190348        4.0
3             6       0.0        NaN        NaN         NaN        0    586        0  40000000  1551190352        4.0
4             7       0.0        0.0        NaN         NaN        0    586        0  40000000  1551190356        4.0
5             8       0.0        0.0        NaN         NaN        0    586        0  40000000  1551190360        4.0
6             9       0.0        0.0        0.0         NaN        0    586        0  40000000  1551190364        4.0
7            10       0.0        0.0        0.0         NaN        0    586        0  40000000  1551190368        4.0
8            11       0.0        0.0        0.0         NaN        0    586        0  40000000  1551190372        4.0
9            12       0.0        0.0        0.0         NaN        0    586        0  40000000  1551190376        4.0
10           13       0.0        0.0        0.0         NaN        0    586        0  40000000  1551190380        4.0
0             3       NaN        NaN        NaN         NaN      200  27462  5354823  40000000  1551190340        NaN

peak TPS over ten blocks:
   blocknumber  TPS_1blk  TPS_3blks  TPS_5blks  TPS_10blks  txcount   size  gasUsed  gasLimit   timestamp  blocktime
0            3       NaN        NaN        NaN         NaN      200  27462  5354823  40000000  1551190340        NaN
1            4       NaN        NaN        NaN         NaN        0    586        0  40000000  1551190344        NaN
2            5       0.0        NaN        NaN         NaN        0    586        0  40000000  1551190348        4.0
3            6       0.0        NaN        NaN         NaN        0    586        0  40000000  1551190352        4.0
4            7       0.0        0.0        NaN         NaN        0    586        0  40000000  1551190356        4.0
5            8       0.0        0.0        NaN         NaN        0    586        0  40000000  1551190360        4.0
6            9       0.0        0.0        0.0         NaN        0    586        0  40000000  1551190364        4.0
7           10       0.0        0.0        0.0         NaN        0    586        0  40000000  1551190368        4.0
8           11       0.0        0.0        0.0         NaN        0    586        0  40000000  1551190372        4.0
9           12       0.0        0.0        0.0         NaN        0    586        0  40000000  1551190376        4.0

Single block, vs averaged over 10 blocks:
peak( TPS_1blk) = 0.00 
peak(TPS_10blk) = nan

./blocksDB_diagramming.py:422: RuntimeWarning: invalid value encountered in double_scalars
  tps=(txs/duration)
second to last experiment block, averaging:
blocks 3-3, timestamps 1551190340-1551190340, duration 0 seconds, txcount 0, tps nan

Traceback (most recent call last):
  File "./blocksDB_diagramming.py", line 713, in <module>
    load_prepare_plot_save(*params)
  File "./blocksDB_diagramming.py", line 633, in load_prepare_plot_save
    emptyBlocks=EMPTY_BLOCKS)
  File "./blocksDB_diagramming.py", line 562, in diagrams
    tpsAv = tps_plotter(axes[0,0], dfs, blockFrom, blockTo, emptyBlocks)
  File "./blocksDB_diagramming.py", line 488, in tps_plotter
    avgLine(ax, dfs, emptyBlocks, avg, avgTxt)
  File "./blocksDB_diagramming.py", line 451, in avgLine
    blMin, blMax = min(dfs["blocknumber"])+1, max(dfs["blocknumber"][:lastFilledBlock_index])
ValueError: max() arg is an empty sequence

"./blocksDB_diagramming.py $DBFILE $INFOWORD ../$INFOFILE" command filed with exit code 0.
@zhuang-weiming
Copy link

zhuang-weiming commented Jul 6, 2019

I have the same problem on ethermint ,
I searched this problem maybe related with here, the same content here.

I wondering how chainhammer project fininshed stress test about the tx.nonce squence prolem?

@drandreaskrueger
Copy link
Owner Author

drandreaskrueger commented Jul 7, 2019

Do you see the same error message ValueError: max() arg is an empty sequence, or what makes you think this is the same problem?

Here in my case it is probably pretty trivial, I just left this issue as a TODO for myself, so I won't forget about it. Thanks for the reminder, I am fixing it today then.

First step - how to reproduce:

CH_TXS=1 CH_THREADING="sequential" ./run.sh just-testing geth-clique

source ../env/bin/activate
./blocksDB_diagramming.py temp.db Geth ../hammer/last-experiment.json

looking into it now ...

@drandreaskrueger
Copy link
Owner Author

drandreaskrueger commented Jul 7, 2019

Obviously, in a benchmarking situation it is an extreme edgecase to fill only 1 block. But then, when trying to plot the diagrams, calculating averages, etc. was causing three problems, see this commit: 28c9cb4

My solution in the end was simply forbidding the whole case, i.e. not generating any diagram if there are less than 2 filled blocks, see here:

if TO_BLOCK-FROM_BLOCK>0:
# fn = diagrams_oldversion(df, FROM_BLOCK, TO_BLOCK, NAME_PREFIX, gas_logy=True, bt_logy=True, imgpath=imgpath)
fig, axes, dfs, txs, tpsAv = diagrams(NAME_PREFIX, df, FROM_BLOCK, TO_BLOCK,
emptyBlocks=EMPTY_BLOCKS)
fn = savePlot(fig, NAME_PREFIX, FROM_BLOCK, TO_BLOCK, imgpath, INFOFILE)
print ("\ndiagrams saved to: ", fn)
else:
print ("\nLess than 2 blocks filled. So: NOT generating diagram!\nPremature ending. You probably do not want this.")
fn="no-diagram-created-because-less-than-2-filled-blocks"
tpsAv=0

Solved. Closing this. Thanks for the reminder.

Good luck finding a solution for your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants