xzm2024's blog

By xzm2024, 5 years ago, In English

I wanna add a problem in polygon and it seems fine in tests and invocations. But when I wanna create package, it says PackageException: Failed on verification of the first test: Interactor 'interactor.cpp' returns exit code -1073741819. I try to fix it but failed. What problem may I have?

UPD: Thank MikeMirzayanov for help. He improved diagnostic messages so that I can know where I have problem.

  • Vote: I like it
  • +12
  • Vote: I do not like it

| Write comment?
»
5 years ago, # |
  Vote: I like it +14 Vote: I do not like it

Maybe it's UB? Download your interactor and run it on input files yourself.

Also, the generator must be deterministic. It must produce the same test every time if ran with the same arguments.

  • »
    »
    5 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Thank you, but it works well when I test on my computer.

    My generator is deterministic but interactor not. Is that OK? I use rnd.setSeed(time(NULL)); in my interactor, however when I change it to something like rnd.setSeed(1);, it still have the error.

    By the way, although my interactor is sometime randomly, it will tout the same thing for right answer(0) and wrong answer(-1). (I changed it just now but it still says the same error)

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it +6 Vote: I do not like it

      Don't use time as a seed in generators or interactors. Polygon might try to check if everything is same if ran twice.

      I guess you must experiment a little bit. Make your interactor simpler, just return verdict "OK" immediately, something like that. See if the error still happens. Try to find a place that causes the error.

»
5 years ago, # |
  Vote: I like it 0 Vote: I do not like it

Here's how return codes work: the OS executes your program, the program leaves the return code in a specified register (of the processor) and when it terminates, the OS checks that register for the return code.

Your program can terminate normally, in which case it leaves behind some return code defined in your source, but also by throwing an exception. Some exceptions are hardware-generated (like divide by zero or segfault, which is accessing a forbidden section of memory), but they're caught in such a way that the OS still gets specific return codes associated with them.

Return codes like that basically mean "garbage bits left over from some previous operation", so your code simply crashed really badly, so badly you aren't even told why.

The worst thing is when code crashes, but you don't see it, because the garbage bits are 0 (but at least it fails to give you an output). I've encountered it locally several times.

»
5 years ago, # |
  Vote: I like it +16 Vote: I do not like it

Can you try again? I tried to improve diagnostic messages.

  • »
    »
    5 years ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    Yeah, thanks! It says PackageException: There exists an output where checker/interactor crashes, output description is "Single line containing '1000000000 1000000000' (without quotes)". Expected exit codes are 0, 1, 2 or 7, but 0 found. .

    But I don't know where that output description comes from. And the exit code seems no problem.

    • »
      »
      »
      5 years ago, # ^ |
        Vote: I like it +9 Vote: I do not like it

      It means your checker/interactor fails if reads Single line containing '1000000000 1000000000' (without quotes). I.e. consider participant prints it, checker/interactor should handle it properly.

      • »
        »
        »
        »
        5 years ago, # ^ |
          Vote: I like it +20 Vote: I do not like it

        Oh yeah! Thanks for your help. I found my mistake with this information. I really didn't handle it properly.