Giter Club home page Giter Club logo

Comments (4)

Blazefrost avatar Blazefrost commented on June 19, 2024

This seems like a problem in the instruction encoding check. As this is caused by the check and not by the process execution, the execution timeout does not apply.

In particular, execution of line 148 of checks.py takes an exorbitant amount of time:

selfie/grader/lib/checks.py

Lines 145 to 148 in e113d85

read_instructions = map(lambda x: read_instruction(
f), range(int(code_length / INSTRUCTIONSIZE)))
if any(map(lambda x: x & instruction_mask == instruction_value, read_instructions)):

Interestingly, while debugging using PDB, it seems like the check determined the code length to be 25,769,803,777 bytes long (approx. 24GiB), which is way off from the the actual size:
image

Furthermore, if Selfie returned a non-zero code, the check would immediately return a failure:

if exit_code == 0:

selfie/grader/lib/checks.py

Lines 161 to 163 in e113d85

else:
return CheckResult(
False, msg, output, 'Selfie returned an error when executing "' + command + '"')

It seems like there is one definitive and potential issue there:

  • The instruction encoding check seems to read an invalid code length from the ELF header. This needs some fixing and possibly a refactor.
  • Selfie does not terminate with a non-zero return code to indicate compilation issues. Unexpected symbol handling seems somewhat inconsistent as sometimes Selfie does exit with a non-zero code immediately, and some other times Selfie does print a message, but continues compilation.

    selfie/selfie.c

    Lines 4435 to 4442 in e113d85

    while (look_for_factor()) {
    syntax_error_unexpected();
    if (symbol == SYM_EOF)
    exit(EXITCODE_PARSERERROR);
    else
    get_symbol();
    }

    selfie/selfie.c

    Lines 4546 to 4559 in e113d85

    } else if (symbol == SYM_LPARENTHESIS) {
    get_symbol();
    type = compile_expression();
    if (symbol == SYM_RPARENTHESIS)
    get_symbol();
    else
    syntax_error_symbol(SYM_RPARENTHESIS);
    } else {
    syntax_error_unexpected();
    type = UINT64_T;
    }

from selfie.

ckirsch avatar ckirsch commented on June 19, 2024

@Blazefrost Interesting! Does gcc return a non-zero exit code if there were warnings but no errors? In that case we may want to mimic that behavior.

from selfie.

Blazefrost avatar Blazefrost commented on June 19, 2024

I opened a new issue regarding the inconsistent handling of unexpected symbol syntax errors because the underlying problem on the grader is that the code length is parsed incorrectly. The exit code short-circuiting works fine on the grader side, but the exit code may need fixing on the compiler side: #280

from selfie.

ChristianMoesl avatar ChristianMoesl commented on June 19, 2024

Ah I know, where that bug was introduced. It was introduced, when we separated the code and data segment in the ELF output of Selfie. @Blazefrost are you working on a fix for that? Or should I take care of it?

from selfie.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.