hhvm icon indicating copy to clipboard operation
hhvm copied to clipboard

Options for JitASize, JitAStubsSize and JitGlobalDataSize won't apply

Open peanutlord opened this issue 12 years ago • 35 comments

Hello Folks,

while running a script in the terminal, which does some heavy work, I got following error:

Assertion failure: 0
data block = prof
message: Attempted to emit 1 byte(s) into a 67108864 byte DataBlock with 0 bytes available. This almost certainly means the TC is full. If this is the case, increasing Eval.JitASize, Eval.JitAStubsSize and Eval.JitGlobalDataSize in the configuration file when running this script or application should fix this problem.


/tmp/tmp.OjiPDtAJbS/hphp/runtime/vm/jit/mc-generator.cpp:2049: HPHP::JIT::Translator::TranslateResult HPHP::JIT::MCGenerator::translateTracelet(HPHP::JIT::Tracelet&): assertion `0' failed.

Notice: Array to string conversion
terminate called after throwing an instance of 'HPHP::Exception'
  what():  unexpected N4HPHP13DataBlockFullE: Attempted to emit 1 byte(s) into a 67108864 byte DataBlock with 0 bytes available. This almost certainly means the TC is full. If this is the case, increasing Eval.JitASize, Eval.JitAStubsSize and Eval.JitGlobalDataSize in the configuration file when running this script or application should fix this problem.

Aborted (core dumped)

I added the ini options as described here: https://github.com/facebook/hhvm/wiki/INI%20Settings, but it won't change anything:

; Site for the jit
hhvm.jit_asize =  536870912 ; 512M
hhvm.jit_astubs_size = 536870912 ; 512M
hhvm.jit_global_data_size = 536870912 ; 512M

After that, I changed the /etc/hhvm/defaults and added those lines:

ADDITIONAL_ARGS="vEval.JitASize=536870912 -vEval.JitAStubsSize=536870912 -vEval.JitGlobalDataSize=536870912"

Still no change, same error, so I tried one last thing. I wrote a config.hdf file with this content:

Eval {
    Jit = true
    JitASize = 536870912
    JitAStubsSize = 536870912
    JitGlobalDataSize = 536870912
}

But still, no change, same error. Perhaps this is no bug and I am missing something - does anyone have an idea? Thank you!

peanutlord avatar Jun 04 '14 11:06 peanutlord

You're missing a - at the start of your ADDITIONAL_ARGS.

Not sure about the ini stuff, tagging @ptarjan.

danslo avatar Jun 04 '14 11:06 danslo

I saw that too and corrected it, still the same error :(

peanutlord avatar Jun 04 '14 11:06 peanutlord

Another note. I changed the config to use 1024M as a test, like this:

Eval {
        Jit = true
        JitASize = 1073741824
        JitAStubsSize = 1073741824
        JitGlobalDataSize = 1073741824
}

I also I get the error (which is fine, I guess?):

Combined size of ASize, AStubSize, and GlobalDataSize must be < 2GiB to support 32-bit relative addresses

So, it seems to check the boundaries, but won't apply any config given.

peanutlord avatar Jun 05 '14 09:06 peanutlord

@peanut-lord how do you know it isn't applying the config. Is HHVM not using less memory? ini_get is currently broken for all these options, so if that is what you are using to test sadly it is a known problem which I'll fix in 3.2.

ptarjan avatar Jun 05 '14 16:06 ptarjan

@ptarjan See #2766; The error message contains the number, which does NOT match what is configured.

liayn avatar Jun 05 '14 17:06 liayn

@liayn I don't think that number in that message is the whole TC. I think it is just the small allocation area. You can see the error message in hphp/util/data-block.h

ptarjan avatar Jun 05 '14 18:06 ptarjan

@ptarjan I'm sorry, I'm not so much into this code. Can you tell me, how to resolve this issue permanently? I'd love to have our site running on hhvm, but with this problem present that is simply not feasible.

liayn avatar Jun 05 '14 18:06 liayn

@peanut-lord: The error message says its out of space in AProf (see line saying "data block = prof"). You need to set it with hhvm.jit_aprof_size=...".

aravindmenon avatar Jun 05 '14 18:06 aravindmenon

@aravindmenon Thank you!

@ptarjan I was guessing, since the value's didn't seem to change. Could you give us a short explaination what those values mean and how much memory one should give those options? Right now I am trying to find the right settings, since the HHVM still stops (our system is a bit heavy, PHP was not really suited, but was used anyway). That would be awesome!

peanutlord avatar Jun 06 '14 06:06 peanutlord

Chiming in because I think I just opened a related issue: https://github.com/facebook/hhvm/issues/2870 Or rather the exactly same issue :)

MarkGavalda avatar Jun 06 '14 12:06 MarkGavalda

@peanut-lord @aravindmenon is best to give you that info. I don't see any docs in our hphp/docs folder about it.

Basically, it is for different segments that we write assembly code into as we compile it. I think everything start in one segment (cold, maybe?) and then we move it around based on how many times it is executed.

ptarjan avatar Jun 06 '14 15:06 ptarjan

These options were renamed: https://github.com/facebook/hhvm/commit/0ca62fba583ff26e66bdcd8a520600419ac0485a https://github.com/facebook/hhvm/commit/ee6d8e5f1ef4a295c5c0628370829c6f16b33d35

fredemmott avatar Jun 09 '14 16:06 fredemmott

Summarizing this: JitAStubsSize removed, JitAColdSize + JitAFrozenSize added

And of course have a look at: https://github.com/facebook/hhvm/wiki/INI%20Settings

liayn avatar Jun 09 '14 16:06 liayn

Hi Folks,

I am seeing the same thing, as was referenced in #2870

Fatal error: unexpected N4HPHP13DataBlockFullE: Attempted to emit 1 byte(s) into a 67108864 byte DataBlock with 0 bytes available. This almost certainly means the TC is full. If this is the case, increasing Eval.JitASize, Eval.JitAStubsSize and Eval.JitGlobalDataSize in the configuration file when running this script or application should fix this problem.

My server.ini has the following, I couldn't start hhvm with the jit_asize, so I have tried the Eval. style. Currently waiting to see if it has made any difference.

;hhvm.jit_asize = 536870912 Eval.JitASize = 536870912 ;hhvm.jit_global_data_size = 536870912 Eval.JitGlobalDataSize = 536870912

;hhvm.jit_a_stubs_size = hhvm.jit_acold_size = 536870912 hhvm.jit_afrozen_size = 201326592

Note I cant find any docs on what jit_a_stubs_size does, so would love some input on this!

We have 2Gb RAM available, with the entire server only using 50%. Each time it hits about 570MB it hangs, and needs a restart.

I am running hhvm --version on Ubuntu 14.04 LTS HipHop VM 3.1.0 (rel) Compiler: tags/HHVM-3.1.0-0-g71ecbd8fb5e94b2a008387a2b5e9a8df5c6f5c7b Repo schema: 88ae0db264d72ec2e2eb22ab25d717214aee568b

Any help gratefully received, its driving me nuts that every 12 hours or less it hangs.

Cheers

65 avatar Jul 24 '14 00:07 65

@65 We have the following in the server.ini and these errors stopped since we started using them:

hhvm.jit_asize = 201326592
hhvm.jit_global_data_size = 201326592
hhvm.jit_acold_size = 201326592
hhvm.jit_afrozen_size = 201326592

If I'm not mistaken your hhvm.jit_asize and hhvm.jit_global_data_size are commented out? That could be one of the problems.

MarkGavalda avatar Jul 24 '14 09:07 MarkGavalda

We're running a similar setup:

hhvm.jit_asize = 200000000
hhvm.jit_astubs_size = 200000000
hhvm.jit_acold_size = 200000000
hhvm.jit_ahot_size = 200000000
hhvm.jit_afrozen_size = 200000000
hhvm.jit_global_data_size = 200000000

The problems did not fully vanish, but at least hhvm does not crash every week.

liayn avatar Jul 24 '14 10:07 liayn

Thanks @MarkGavalda @liayn I did have a couple of these lines, but the last time I tried it hhvm wouldnt start.

I have put them in again, and its up. We will see what happens.

65 avatar Jul 24 '14 11:07 65

I've seen this error for the first time today, it's been the longest we have used hhvm in a production environment for.

[Wed Aug 27 08:28:19 2014] [hphp] [23961:7f0af07ff700:94338:000001] [] \nFatal error: unexpected N4HPHP13DataBlockFullE: Attempted to emit 26 byte(s) into a 25165824 byte DataBlock with 7 bytes available. This almost certainly means the TC is full. If this is the case, increasing Eval.JitASize, Eval.JitAColdSize, Eval.JitAFrozenSize and Eval.JitGlobalDataSize in the configuration file when running this script or application should fix this problem.

What are the default hhvm.jit_asize options set to? 25mb?

Or is 60 << 20 = 62914560 = 6291456 = 7.86mb?

My dump of the ini settings (using hhvmdump script) does not provide it. What does 201326592 set it to? 200mb?

cscd98 avatar Aug 27 '14 08:08 cscd98

Well, they're hhvm.jit_a_size (and similar) now. You can see the defaults here. << 20 turns the number into megabytes.

simonwelsh avatar Aug 27 '14 09:08 simonwelsh

Looking at source then,

JitASize 60mb JitAColdSize, 24mb JitAFrozenSize 40 mb

JitGlobalDataSize get's set to (60 << 20) >> 2, what is that? Thanks

cscd98 avatar Aug 27 '14 09:08 cscd98