ID:1387058
 
Resolved
Permission requests, such as for shell() or for access to a file in ultra-safe mode, could cause the server ticker to shutdown in rare cases.
BYOND Version:500.1210
Operating System:Windows 7 Ultimate 64-bit
Web Browser:Chrome 29.0.1547.76
Applies to:Dream Daemon
Status: Resolved (500.1212)

This issue has been resolved.
Descriptive Problem Summary:

Numbered Steps to Reproduce Problem:

Code Snippet (if applicable) to Reproduce Problem:
/datum/StreamReader
var
SeekPosition = 1
TextFile

New(var/File)
if (FALSE) // Set to TRUE to break BYOND

// If is (Filename or File data as text)
if (istext(File))
if(fexists(File)) // Is it a filename?
TextFile = file2text(file(File)) // Then load it
else
TextFile = File // Nope, just the file text. Use as-is
else // Is file object
TextFile = file2text(File)

else
TextFile = File // assume file text (INCORRECT BEHAVIOUR, BUT DOESN'T CRASH SLEEP() PROCS)


Expected Results:
When if (TRUE), loads file and continues with no side-effects
Actual Results:
when if (TRUE), loads file but causes every current and future call to sleep() to hang indefinitely.

Does the problem occur:
Every time? Or how often? Every time
In other games? not tested
In other user accounts? not tested
On other computers? no testable

When does the problem NOT occur? when leaving it as if(FALSE)

Did the problem NOT occur in any earlier versions? If so, what was the last version that worked? Not testable, uses v500 features in project

Workarounds: None, really. if(FALSE) breaks so much other functionality in this project.
Can you provide an example with sleep()...?

Like, a full demo maybe?
I didn't have time for that last night (it was 11:30 PM), but I will try and get a whittled-down version of this project built.
okay.

http://sukasa.rustedlogic.net/HungSleep.zip

The project as-in runs okay, without exhibiting the bug. It will simply end at a black screen after the splash cards - this is fine.

Open Project/Code/Utility/StreamReader.dm, and change the if (FALSE) on line 7 to if (TRUE). This will make BYOND exhibit the bug and hang every call to sleep().

You can confirm sleep() is not returning both from the debug output from the sidebar, and from the fact that the player character stops moving around when you press W/A/S/D.
I set it to TRUE, and it works fine...?
Sounds to me like this belongs in Developer Help.

What you posted works fine, and changing the if(FALSE) to if(TRUE) doesn't affect anything other than that particular block of code executing.

Sounds to me like you have some other code that is interfering.

Also, your demo is useless. It looks like you just deleted all your icons and packaged it. It doesn't compile, and I don't even know where to look to find out your problem.
I do see the issue he explains, but only in one circumstance...if it's ran in ultra-safe mode (directory name doesn't match DMB name), rather than safe or trusted.
Yep. The only circumstance where this would happen is if the entire world is hung up because you are trying to access files you don't have permission to use. Good catch. I've had people post on the forums with this problem before, too.
In response to Keeth
I made sure that the project, as stored in the .zip, compiled before copying it to my server.

What compilation errors are you getting?

Also, I'm granting access to every file (and I've tried multiple times to eliminate any mistakes on my end), and the results are always the same.
In response to Topkasa
Topkasa wrote:
What compilation errors are you getting?

Compilation errors were my fault.
Manually granting access to every file doesn't work, for some reason. You'd have to manually set it to Safe or Trusted mode when using Dream Seeker locally. Dream Daemon automatically goes to Safe.

Just change the name of the directory to match the DMB and you're good to go.
Nice to know I can use that workaround. However, unless I'm sorely mistaken, there is still a bug here that could stand to be fixed?
In response to Topkasa
It's not a workaround. The folder needs to match the environment name. That's just how it works.
...Which is a workaround for the fact that in Ultrasafe mode, this bug with sleep() exhibits itself while it does not do so in Safe or Trusted mode. That's what I mean by workaround.
The issue is that you're not accepting the file access request so the server hangs waiting for you to. The reason it's not happening in safe/trusted is because it's not asking to access any files.

There's no bug with sleep(), you're just blocking the stack from continuing to execute.
That's incorrect; after I click yes on every dialog, the calls to sleep() remain perpetually hung.
From what I can tell, there is an issue with all sleeping procs (spawn, too) causing everything to stop responding (all commands), but it's bigger than just what you're reporting, I think.

What happens if you try to run the start-up stuff through a proc call in a verb, rather than at start-up?

(Though...you should probably just not have it run in Ultra-Safe mode, I doubt Lummox will consider this a priority bug to fix because Ultra-safe isn't really supposed to be used.)
It has the same effect of crashing sleep() when used via verb as it does when it's called from world/New().

I tested this by altering the ticker to run regardless of if a game mode has been specified, and then moved the code to create and start the game mode into a separate verb. Before running the verb, the ticker worked and the player mob moved around fine. After running the verb (and clicking Okay on -every- file access dialog), every call to sleep() hung.

I didn't test this change on the original version, as that's had the workaround of changing the folder name to the environment name done so as to enable Safe mode instead of Ultrasafe.
Sidenote: I confirmed that it isn't just commands failing, and is indeed the ticker, by adding an increasing counter to the ticker and running world.log << Ticks every cycle. It stopped outputting any text to the client right after the final file-access dialog (as well as while any dialogs were on-screen).
I moved this to Bug Reports because it doesn't appear to be beta-related in any way.

I've downloaded and compiled the demo, but I don't really know what I'm supposed to be looking at. If I accept the safety warning so it can read those files, everything is fine. If I don't accept, it waits. It then will continue once I accept, and the sleep() calls after that don't appear to be failing.

Whatever's going on here, I'd like to understand it because it could be related to a different project.
Page: 1 2