Toph's Next Steps

If you are here and reading this, you are probably a sport programmer, and we already have a lot in common. And, it is from that I know how important it is for a sport programmer to have an interruption-free experience during programming contests.

During the recent on-site contests at Islamic University of Technology (IUT) and Shahjalal University of Science and Technology (SUST), Toph encountered some issues that severely hampered the experience of the participants. First and foremost, we want to apologize for the inconvenience this has caused.

Contest participants usually have very restricted interaction with Toph, limited mostly to the contest arena, barred from most of the features Toph has to offer. And, so regardless of the cause, the way the participants experience them are similar: slow loading of the arena or queued submissions.

The root cause of the imperfect experience at these two contests was quite different.

We monitored our infrastructure closely during the IUT contest. Based on our findings we were able to fix some of the issues that caused the queue to be unstable. Unfortunately, we discovered the remaining issue only after the contest at SUST had begun.

This remaining issue has always been very elusive as it affected our load balancers (which in turn affected our entire infrastructure). But, the severity of this issue depended directly on the geographic distribution of the users. As a result, it rarely affected online contests. But, it hampered on-site events with a large number of participants.

While addressing the issues discovered during the IUT contest, we also implemented more rigorous logging and monitoring for our infrastructure. And, it helped us identify the remaining problem during the event at SUST rather quickly. It took us about 40 minutes from the start of the contest to implement a fix and deploy the changes to our infrastructure. As reported by many participants, it was right about that time when the stability of the platform improved.

The other bug that we encountered during the contest caused truncated I/O files for problems that used the line-ending correction feature in Toph Drafts. We fixed it before the rectified the balancer configurations. We synchronized everything and checked and double checked to make sure no other problems were affected.

It is unfortunate that the Internet issue prevented from completing the contest. We were still glad to see how hard the organizers of the event at SUST tried to recover from the situation.

So what is next for Toph? Improve.

It is important that we do not stop at just addressing the bugs and misconfigurations we have identified in these two events, but that we continue to improve consistently.

We believe that a stitch in time saves nine. And so, with these major issues addressed, we have already begun working on fixing other quirks and issues. We will also make improvements throughout Toph and Toph Drafts over the coming days enhancing your experience on the platform.

We also want to welcome everyone to Toph Community, and we want to encourage everyone to share their constructive (or even destructive) criticism here. It is worth stressing, that these recent events and every feedback that you have shared have helped us improve Toph. And, You can help us more by communicating your feedback directly to us.

Please feel free to share your thoughts and feedback here in Toph Community and for anything that you think deserves immediate attention, you can always @-mention me directly.

3 Likes

Please make the loading faster during contest.

2 Likes

The “Test” button didn’t seem to work during the contest. The gets() does not seem to work too though some will say gets() is non standard.

During load of any page, it will be better not to show Quotes as it just makes things worse and more frustrating.

It will be better to have Custom Invocation like in CF because it can save some one or two WAs by helping us to find out whether certain functions/libraries work in the Toph compiler or not.

I also saw that for interactive problem of the IUT contest, the “Test” button doesn’t seem to work. It just goes on and on like an infinity loop.

1 Like

@Peregrine_Falcon Welcome to Toph Community!

This is something we have started working on.

A lot of changes have been introduced recently to ensure that the arena loads faster. This includes caching data that the arena needs when loading and more.

Some of these changes were added just a week ago and we were hoping to see the improvements work during the SUST contest.

Unfortunately, the misconfigured balancer threw everything off, and it hampered the performance of the arena in a different way than we had anticipated.

As mentioned in the original post, since then the balancer configuration has been fixed and we hope to see the expected performance in future contests.

Over the next few days we will be stress testing Toph using different performance auditing tools to validate our work.

The following two screenshots show a very rough and quick test that demonstrates Toph’s ability to now sustain a reasonable average response time after the recent improvements and rectification of the balancer issues.

There still are room for improvements and we already have that in our plans for the next couple of weeks.

@PsychoKiller These are really valuable feedback! Thank you so much for sharing them.

Could you please let me know which specific language option of C/C++ did you use where you saw gets() working? Ideally, what you said, is correct. gets() is not standard and should not be allowed. However, it is possible that for certain C/C++ option, the GNU C/C++ compiler allows it. It depends on what parameters we pass to the compilers when we process your submissions.

We have a page where we share the details about the programming languages we support and the compiler options we use. You can find the page here: Languages | Toph.

I will still look into this and add some notes to the languages page as necessary.

We have always received mixed reactions regarding quotes shown on the loading screen. Personally, I am indifferent about it. However, since I think there is a considerable number of users who do not like it, we will remove it in the next couple of days.

Custom invocation is something we have in mind. This is something we would however want to get to later this year as at this moment our focus is to improve stability and performance over all things. Some of the new features will then have to wait a little.

The issue with the test button not working for interactive problems has to do with the fact that the problem didn’t have any sample test case. The example case you saw was just text added at the end of the Output specification section:

And the bug is that when there are no sample test cases for a problem, the Test button is effectively broken. This is something we might not have discovered immediately unless you had brought it to our attention, so thank you for that! We really appreciate it.

Thank you for the reply. I used C++ 14 and found that gets() does not work.
And please try to make sure that the setters provide sample test cases for the problems. So, even there is no custom invocation, we can use the “test” button to see if the toph compiler agrees with us.

And one more thing, though it is not a problem, but it will be better if all the problems follow a similar kind of output tradition for a contest. For example, in a contest, some problems output tell to write “Case 1: ans”, some says “Case #1: ans” and some just say to write “ans”. So, maybe a conventional output pattern for all problems in a specific contest seems more professional and better.

Anyway, good wishes for Toph and would like to see it become a regular programming contest platform in our country.

3 Likes

There is a difference between “cool” and “regular” product.
Though I am kind of old and not from this generation of problem solver,
I believe, showing “quotes” makes Toph cool and removing it from Toph will make it a regular OJ.

3 Likes

Welcome to Toph Community, @Kryptonyte!

Let’s see if we can find a solution that will make everyone happy. :slightly_smiling_face:

1 Like

@PsychoKiller I see what you mean now regarding gets(). I misread your remark earlier. I thought you were able to use gets().

gets() is deprecated and it is unsafe. Therefore, it is important that we restrict its usage (even if it means sacrificing a little convenience). You can read more about why it is considered unsafe here.

Regarding problem statements, test case patterns, editorials, etc, this is something we want to standardize. However, at this stage, a majority of the programming problems that are hosted on Toph were prepared under the direction of different contest directors and lead authors. And, most of them were not done under Toph team’s supervision.

But, yes, I agree that it is important to standardize these things. And, I believe, Toph has the influence to slowly start working on that with all problem authors.

Thank you once again for your feedback!

For interactive problem, the solver (problem solver) will interact with some part of the code given by the author.
What I understand from interactive problem,

Author's code will response <------> Solver's code will response.

If I want to set an interactive problem in toph, does it have language agnostic property? What I mean that in the solver side if he/she is using C/C++, Can the author’s code be python?
What about additional library, Can Author request for additional library or predefined python environment (virtual env/anaconda env) to write his part of the code. @hjr265

@Kryptonyte The way interactive problems are dealt with, it is language agnostic. The two programs communicate through their standard I/O. So, something that one program prints is read by the other, and it goes the other way round as well.

The only nuance here is that the driver program (program written by the problem author) needs to read/write to a pair of special files instead of its standard I/O to communicate with the solver’s program.

Here is what a very simple driver looks like:

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <fcntl.h>

int main() {
    FILE *pfin, *pfout;
    pfin = fdopen(3, "r");
    pfout = fdopen(4, "w");

    int n;
    scanf("%d", &n);

    bool ok = false;

    int l = 25;
    while(l--) {
        int x;
        int e = fscanf(pfin, "%d", &x);
        if(e != 1) {
            break;
        }

        if(x < n) {
            fprintf(pfout, "Bigger\n");
            fflush(pfout);
        } else if(x > n) {
            fprintf(pfout, "Smaller\n");
            fflush(pfout);
        } else {
            fprintf(pfout, "Bingo!\n");
            fflush(pfout);
            ok = true;
            break;
        }
    }

    if(ok) {
        printf("0\n");
    } else {
        printf("1\n");
    }

    return 0;
} 

And, just like how custom checkers work in Toph, at the end, the driver just has to print a “0” to signify that the solution is correct. Any other output by the driver will yield a Wrong Answer for the submission.

Regarding the environment of the different stacks that Toph uses (e.g. GCC, Go, Python, PyPy, etc), they are fairly vanilla.

We plan to make a list of commonly used libraries available in these environments in the near future. We will for sure take input from the community then when choosing these libraries.

2 Likes

If it changes you are talking about, then I will recommend the documentation of features that toph releases. Just like someone has mentioned that the gets function isn’t working properly, there might be other things that people want to know about Toph. In such cases, I think proper documentation is necessary.

I often feel that the help pages of Toph are poorly made.

Also, I will personally want documentation of the markdowns that I can be used in Toph. Like the code you have shared just now, I don’t know how have you marked it language-wise. If I just use four spaces, the key words are not highlighted. Although I have asked it in a forum post, I didn’t get any replies. I have already thought that it was not possible in Toph before seeing your reply here.

@touhidur You can use fenced code blocks to get syntax highlighting and it will look like this:

{
    "key": "value"
}

Documentations are a work in progress and the help site is still being worked on. If you have any questions, please always feel free to ask us any time. Although keep in mind that during holidays you may not get responses as promptly.

1 Like

@hjr265
It would be good if Toph had some way to filter the unsolved problems.
Just a checkbox would do.

1 Like

@touhidur That is a good suggestion! I will add it to our list.

@touhidur Done :slight_smile:

1 Like

The code markups in Toph tutorials, is horrible.
Codes are heavier to read when there is no markup.
Or, at least for me, it is…
I think it would be good, if you think about it.

@touhidur The code snippets there are placeholders for now. They will be replaced with something else.

1 Like

solved / unsolved switch button does not appear in problem search.