Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

malloc problem in file io ? #298

Closed
Cpasjuste opened this issue Oct 4, 2017 · 15 comments

Comments

Projects
None yet
3 participants
@Cpasjuste
Copy link
Contributor

commented Oct 4, 2017

Hi,

When developing my usbhostfs module i noticed some random crash on file io. I thought the problem was in my module, but i isolated the problem to the malloc calls in "file.c". I guess you may pushing the limits there. You may be able to reproduce the crash by doing multiple times this procedure :

  • copy directory "ux0:user" to "ux0:temp" (as an example)
  • delete the directory "ux0:temp"

Before posting this report i tried disabling the only user (sceshell) module i use (psp2shell), whith the same results.

@Cpasjuste

This comment has been minimized.

Copy link
Contributor Author

commented Oct 4, 2017

Doing more research i found that around 106 MB of memory is available, so i guess there's something more. I wonder if using malloc in threads (copy_thread, delete_thread..) is safe ?

@limyz limyz added the bug label Oct 4, 2017

@Cpasjuste

This comment has been minimized.

Copy link
Contributor Author

commented Oct 5, 2017

Hi,

I'm now not sure it's a bug in VitaShell anymore :/
I was not able to reproduce the problem when not enabling my (kernel) usbhostfs plugin, so it may corrupt the memory (?!). I was almost sure to have this problem with no plugin enabled, but maybe i did something wrong. I'll try to take another look today and report. (by the way, malloc IS thread safe).

@Cpasjuste

This comment has been minimized.

Copy link
Contributor Author

commented Oct 5, 2017

So, i can confirm the problem still happen randomly even with no plugins enabled (on enso at least). I was sometime able to do the copy more than 5 times without VitaShell crashing, sometime it crash at the first copy. It can also happen on delete.

@TheOfficialFloW

This comment has been minimized.

Copy link
Owner

commented Oct 11, 2017

please test 1.74

@limyz

This comment has been minimized.

Copy link
Contributor

commented Oct 11, 2017

This problem is so similar to the one most recently posted - shall wait before tagging that as duplicate.

@Cpasjuste

This comment has been minimized.

Copy link
Contributor Author

commented Oct 11, 2017

I will take a look tomorow.

@Cpasjuste

This comment has been minimized.

Copy link
Contributor Author

commented Oct 12, 2017

From my testing i don't spot the problem with version 1.74. I still have random crashes when doing file io on host0 with my usbhostfs plugin, but i'm now sure it's a problem with my module. I guess you suspect the changes in the dialog code to cause this in 1.75. I would need to do more testing on 1.75 to be sure i didn't do something wrong when testing on it.

@Cpasjuste

This comment has been minimized.

Copy link
Contributor Author

commented Oct 12, 2017

So, it seems i fixed my module, and there is no more problem with 1.74. I'll test again with 1.75 soon.

@Cpasjuste

This comment has been minimized.

Copy link
Contributor Author

commented Oct 12, 2017

I can confirm the problem doesn't exist on 1.74 but exist on 1.75. I guess there is maybe a problem with this commit : e3f52cc

@Cpasjuste

This comment has been minimized.

Copy link
Contributor Author

commented Oct 12, 2017

I guess there is a logic problem at this line, i'll take a closer look tomorrow :

tempstr[i+1] = '\0';

@Cpasjuste

This comment has been minimized.

Copy link
Contributor Author

commented Oct 12, 2017

Also, strdup should be freed, which is not the case here.

tempstr = strdup(uncommon_dialog.msg);

@Cpasjuste

This comment has been minimized.

Copy link
Contributor Author

commented Oct 13, 2017

Fixed in dae6212

@Cpasjuste Cpasjuste closed this Oct 13, 2017

@TheOfficialFloW

This comment has been minimized.

Copy link
Owner

commented Oct 13, 2017

Did you test the new build?

@Cpasjuste

This comment has been minimized.

Copy link
Contributor Author

commented Oct 13, 2017

Yes just now, no more crash. I saw your changes in "dialog_uncommon", the problem was there for sure.

@limyz

This comment has been minimized.

Copy link
Contributor

commented Oct 14, 2017

Awesome work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.